Data Definition Language(DDL)

In DDL we will know more about tables, which is the object of a database that is responsible for storing the data. Other than this we will also get to know about establishing relationship between tables and also how to alter and drop tables.
SQL TABLE
It is an object where we can store data. The data inside a table is arranged in a row and column format. Thus the components of a table are- records(rows), fields(columns) and data(values in each cell-row and column intersection). Each field should have a name or heading. Each row of information is called as record.

student
Regd.no Name Address Gender

R103

R105

R107

Sushree Panigrahi

Sushrita Naik

Jayadev Sahoo

Bhubaneswar

New Delhi

USA

Female

Female

male

In the above table we can see that data is arranged in row and column format. The first row contains the field names(Regd.no,name,address,gender). The second row onwards are the records. R103,sushree panigrahi, Bhubaneswar, Female are values.
SQL TABLE structure:
A table can be created at any time while we are using the database. While creating a table, the size occupied by it is defined by the amount of space that is allocated to the database. In other words the user does not have to specify the table size. A table structure helps us to know more about a specific table, like:

SQL TABLE naming rules:
A table name

It is advisable to give meaningful names for tables and other objects . in Oracle names are case insensitive. For example STUDENT is treated as the same name as student or Student.
How to create a SQL TABLE:
The CREATE TABLE statement helps us to create a table. To create a table a user must have the create table privilege. The syntax of create table statement is:

Example

CREATE TABLE table-name
(
Column1 datatype1(size),
Column2 datatype2(size),
Column n datatypen(size)
);

SQL CREATE TABLE Example:

Example

CREATE TABLE employee
(
emp-id varchar2(12),
name char(10),
salary number(8),
designation char(15)
);

The above statement create an employee table having four attributes named Emp-id, Name,, Designation. If we want to confirm the creation of the table , then the describe statement can be used.
Syntax of describe statement:
Describe table name;
For example, describe employee;
After executing this statement it will display

Name Null Type
emp-id varchar2(12)
name char(10)
salary number(8)
designation char(15)

The employee table can be filled with data with the INSERT INTO statement.



  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved