-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate Table in SQL.txt
More file actions
37 lines (35 loc) · 1.02 KB
/
Create Table in SQL.txt
File metadata and controls
37 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
1. Create Table
syntax:CREATE TABLE table_name(
Column_name1 data_type(size),
Column_name2 data_type(size)
);
ex:
CREATE TABLE student_rec(
name varchar(255),
roll number (10),
address varchar (255)
);
Table
*************************
* name * Roll * Address *
*************************
* * * *
*************************
2nd example:
2. Create Table
syntax:CREATE TABLE table_name(
Column_name1 data_type(size)[constraints],
Column_name2 data_type(size)[constraints],
); Column_name2 data_type(size)[constraints]
ex:
CREATE TABLE student(
name varchar(255) NOT NULL,
roll number (10) PRIMARY KEY,
address varchar (255)
);
-> Guidelines for creation of Table
.-> Table name should start with an alphabet
.-> I table name, blank spaces and single quotes are not allowed
.-> Reserve words of that RDBMS/DBMS cannot be used as table name
.-> Proper data type and size should be specified
.-> Unique column name should be specified