

However, before making these associations, the structure of such groups of columns and rows needs to be defined in the table markup: In this case, they are associated with by using the value rowgroup in the scope attribute. The same principle applies to header cells spanning multiple rows. This can be done by setting the scope attribute of the header cell to the value colgroup. Table with headers spanning multiple rows or columnsįor example, a header cell that spans three columns should be associated with corresponding data cells in the column group.In our example, the name column could have been varcar (short for a variable character)īLOB: This stores binary data other than text, for example, file uploads. VARCHAR: This stores a limited amount of text or single characters. Some examples would be 2.5, -.664, 43.8882, or 10.00001.ĭATETIME: This stores a date and time in the format YYYY-MM-DD HH:MM:SS In our example, the age category could have been an integer.įLOAT: This stores numbers when you need to use decimals.

INTEGER: This stores whole numbers, both positive and negative. Although these have many subcategories, we will just touch on the most common types that you will use in this tutorial.

The main data types are numbers, date/time, text, and binary.

We could not change Kelly's entry to "twenty-six" if we had defined that column to be a number. An example of what this means is in our age column we use a number. This not only saves time but also valuable database space as no piece of data needs to be repeated.Įach column can only contain one type of data which we must define. You would only ever have to type this information once despite it being accessible for every car in the database. You could then dynamically call the contact information from our second table for every car in our first table. Here you could list the address, phone number, and other contact information for each of these companies. In this table, we could list Ford, Volkswagen, Chrysler, etc. What we can do is create a second table, called manufacturers. However, the contact information for 'Ford' would be the same for all of the cars they make, so we do not need to type that data more than once. We could make one table to hold all of the details for each of the cars we were selling. Let's say for example we were making a database for a car dealership. So what is a 'relational' database, and how does it use these tables? Well, a relational database lets us 'relate' data from one table to another. Of 03 Understanding SQL Relational Databases
