055 CreateTABLE S AndTempTable S
055 CreateTABLE S AndTempTable S
What is Table ?
• Tables are database objects that contain all the data in a database. .
• Each table should have a primary key which consists of one or more columns. Typically, you list the primary key columns first and then other
columns.
• If the primary key contains only one column, you can use the PRIMARY KEY keywords after the column name. If the primary key consists of
two or more columns, you need to specify the PRIMARY KEY constraint as a table constraint.
• Each column has an associated data type specified after its name in the statement.
• A column may have one or more column constraints such as NOT NULL and UNIQUE.
• A table may have some constraints specified in the table constraints section such as FOREIGN KEY, PRIMARY KEY, UNIQUE and CHECK.
CREATE table example
• CREATE TABLE sales.visits (
• A temporary table stores a subset of data from a normal table for a certain period of time.
• Temporary tables are particularly useful when you have a large number of records in a table and you repeatedly need
to interact with a small subset of those records.
• In such cases instead of filtering the data again and again to fetch the subset, you can filter the data once and store it
in a temporary table.