Tables are a basic unit of organization and storage of data in SQL. Each table has a name such as an author, book_mast, purchase or orders. A table is similar to a file in a non-database system.
Tables are organized into rows and columns. Each row represents a record, and each column can be thought of as representing a component of that record.
Syntax:
Parameters:
Name | Description |
---|---|
table_name | Name of the table where data is stored. |
column1,column2 | Name of the columns of a table. |
data_type | Char, varchar, integer, decimal, date and more. |
size | Maximum length of the column of a table. |
CREATE TABLE is the keyword telling the database system what you want to do. In this case, you want to create a new table. The unique name or identifier for the table follows the CREATE TABLE statement.
Then in brackets comes the list defining each column in the table and what sort of data type it is. The syntax becomes clearer with the following example.