Pages

Tuesday, January 18, 2011

CREATE

CREATE

-=========================================[CREATE]====================================================================
--Create is used to create Database or Tables.

--Create Database (with default parameters)---
CREATE DATABASE testdb

--Create Table (Proper DB should be selected, here testdb is selected)
CREATE TABLE employee(
     ID          int,
     name        nvarchar (10),
     salary      int,
     start_date  datetime,
     city        nvarchar (10),
     region      char (1))

 INSERT INTO employee (ID, name,    salary, start_date, city,       region)
               values (1,  'Jason', 40420,  '02/01/94', 'New York', 'W')
 INSERT INTO employee (ID, name,    salary, start_date, city,       region)
               values (2,  'Robert',14420,  '01/02/95', 'Vancouver','N')
 INSERT INTO employee (ID, name,    salary, start_date, city,       region)
               values (3,  'Habib', 90020,  '12/03/99', 'Toronto',  'W')
 INSERT INTO employee (ID, name,    salary, start_date, city,       region)
               values (4,  'Linda', 40620,  '11/04/97', 'New York', 'N')
 INSERT INTO employee (ID, name,    salary, start_date, city,       region)
               values (5,  'David', 80026,  '10/05/98', 'Vancouver','W')

SELECT * FROM employee

No comments:

Post a Comment