In SQL, The CREATE TABLE statement is used to define and create a new table. This statement specifies the table name, the columns it will have, and their data types.
CREATE TABLE table_name ( column1 datatype, column2 datatype, ... PRIMARY KEY (one_or_more_columns) );
table_name: This is the name of the table you want to create.
column1, column2, ...: These are the names of the columns in the table.
datatype: Specifies the data type of each column.
PRIMARY KEY: Specifies the primary key for the table, which is a unique identifier for each row. It can consist of one or more columns.
CREATE TABLE products ( product_code INT PRIMARY KEY, product_name VARCHAR(50), product_price VARCHAR(50), product_upload_date DATE, );
The table is named "products".
It has columns: "product_code", "product_name", "product_price", and "product_upload_price".
The data types are specified for each column (INT for integers, VARCHAR(50) for variable-length character strings, and DATE for dates).
The PRIMARY KEY constraint is set on the "product_code" column.