Creating Tables
First, let’s look at how we can create tables to add to our database. To create a table, we use the following syntax:
CREATE TABLE table_name (
column_name1 datatype [column constraints],
column_name2 datatype [column constraints],
…
[table constraints],
[table constraints]
);
Let’s discuss the syntax in detail.
Tables in SQL databases are organized in rows and columns. Suppose we want to create a table to store information about the employees of a company. We can design the table as shown below:
Each column in the table stores a specific piece of information about the employee (such as the id, name and gender of the employee).
Each row, on the other hand, stores information about...