Table Creation
Entities are represented as tables in database. The attributes of entities are represented as columns. As the data’s are stored in the attributes of entities the data’s are stored in columns in tables. Tables are organized into rows and columns.
For example the Customer entity can be represented as Customer table and the attributes like Name,Age,Gender,Occ,Phone,Location,Work Exp can be represented as
columns in the table.
Create Table
The CREATE TABLE statement is used to create a table in a database. Create table
statement comes under Data Definition language (DDL)
Syntax
CREATE TABLE Table ( Column1 Data type(size), Column2 Data type(size),....);
While creating table we need to
Specify the table name
Specify the column names
Specify what type of data each column need to hold (e.g. varchar, integer, decimal, date,
etc.).
Specify the size parameter,which the maximum length of the column of the table
Example
Create table Customer(CustomerID int,Name varchar(50),Age int,Gender
varchar(10),Occ varchar(10));
No comments:
Post a Comment