Database Reference
In-Depth Information
Figure 3-7. Create database statement with arguments
Now you know how to create a database using code, both by using simple techniques and by using
arguments, so it's time to learn how to create tables in those databases.
Understanding Table Fundamentals
The database you created earlier will be of no use if there is no table in it, because tables provide the
infrastructure for data storage.
Before you start creating a table, you should understand the basics of it. A table consists of columns,
and then data is added ( inserted ) into the table as rows. (In relational database theory, a row is also
known as a record or tuple , and a column is known as a field .) The type of data that can be entered as a
row is defined by the data type of individual columns in the table. Most of the time it becomes obvious
what type of data you need to enter; for example, a name will require a string or character data type,
whereas an age will require an integer data type.
In addition, it is important to know which column needs a data entry. Null or Not Null keywords
specify the data acceptance criteria, in other words, whether you must enter or can skip a column value.
For example, consider you are filling a form for insurance and are asked to enter your first name,
followed by your address and SSN. In such a scenario, not everyone will have SSN, but a first name is a
must for any individual.
Based on these two columns, you have a business scenario, and this business requirement in terms
of a database can be accomplished by specifying the first name column as Not Null and the SSN column
as Null while creating a table.
 
Search WWH ::




Custom Search