SQL CREATE TABLE Statement
The CREATE TABLE Statement is used to create tables to store data. Integrity Constraints like primary key, unique key, foreign key can be defined for the columns while creating the table. The integrity constraints can be defined at column level or table level. The implementation and the syntax of the CREATE Statements differs for different RDBMS.
The Syntax for the CREATE TABLE Statement is:
CREATE TABLE table_name
(column_name1 datatype,
column_name2 datatype,
... column_nameN datatype
);
• table_name - is the name of the table.
• column_name1, column_name2... . - is the name of the columns
• datatype - is the datatype for the column like char, date, number etc.
For Example: If you want to create the employee table, the statement would be like,
CREATE TABLE employee
( id number(5),
name char(20),
dept char(10),
age number(2),
salary number(10),
location char(10)
);
In Oracle database, the datatype for an integer column is represented as "number". In Sybase it is represented as "int".
Oracle provides another way of creating a table.
CREATE TABLE temp_employee
SELECT * FROM employee
In the above statement, temp_employee table is created with the same number of columns and datatype as employee table.
Subscribe to:
Post Comments (Atom)
VMware Cloud Learning Video's
Here is a nice summary list of all VMworld US 2018 Breakout session with the respective video playback & download URLs. Enjoy! Bra...
-
Different types of bra Welcome to this post, we are here to help you with the different types of bras out there and help you make the ...
-
Most of women now days are very conscious about their future. Time has changed now women are now doing much better than men in corporate w...
-
Mens Fashion Wear Hugo Boss is one of the leading designers of high-end menswear in the world today, but the company has a checkered ...
No comments:
Post a Comment