Probably before using a database, you must first have one. In the previous lesson, we saw that there were different
ways to connect to a server.
The SQL is very flexible when it comes to names. In
fact, it is very less restrictive than C#. Still, there are rules you
must follow when naming the objects in your databases:
- A name can start with either a letter (a, b, c, d, e, f, g, h, i, j,
k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G,
H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, or Z), a digit
(0, 1, 2, 3, 4, 5, 6, 7, 8, or 9), an underscore (_) or a non-readable
character. Examples are _n, act, %783, Second
- After the first character (letter, digit, underscore, or symbol),
the name can have combinations of underscores, letters, digits, or
symbols. Examples are _n24, act_52_t
- A name cannot include space, that is, empty characters. If you want
to use a name that is made of various words, start the name with an
opening square bracket and end it with a closing square bracket.
Example are [Full Name] or [Date of Birth]
Because of the flexibility of SQL, it can be difficult
to maintain names in a database. Based on this, there are conventions we
will use for our objects. In fact, we will adopt the rules used in C/C++,
C#, Pascal, Java, and Visual Basic, etc. In our databases:
- A name will start with either a letter (a, b, c, d, e, f, g, h, i,
j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F,
G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, or Z) or an
underscore
- After the first character, we can use any combination of letters,
digits, or underscores
- A name will not start with two underscores
- A name will not include one or more empty spaces. That is, a name
will be made in one word
- If the name is a combination of words, at least the second word will
start in uppercase. Examples are dateHired, _RealSport, FullName, or
DriversLicenseNumber
|