Wednesday 6 August 2014

Relational Query Languages | How to create table in sql


CREATING TABLES AND VIEWS
  • CREATING TABLES
CREATE: This command is used when we want to create a new table.
syntax: create table <tname>  (col.1 data type (size) constraint <constraint name> not null , col.2 data type (size));
E.g.: create table mydoc1 (username varchar (20) constraint name_mn not null, password number(10));


  • VIEWS
We can use views to display the particular values from  a table as separate sub table. for example a table emp details has 8 fields and we can build a view with 3 fields from the table.

SYNTAX- 
  • For creating a view -create or replace view <view name> as  <basic query for retrieval> with read only;
  • For dropping a view- Drop view view name;

0 comments:

Post a Comment