Sat Apr 07, 2007 7:21 pm
CREATE TABLE DEPT
(
DEPT_ID int Primary Key,
DEPT_NAME varchar(2) Unique,
DESCRIPTION varchar(100) Not Null,
Constraint DEPT_NAME_CK Check (DEPT_NAME in ('CS','IT','IS','DS'))
);
CREATE TABLE DEPT
(
DEPT_ID int,
DEPT_NAME varchar(2),
DESCRIPTION varchar(100) Constraint DESCRIPTION_NN Not Null,
Constraint DEPT_ID_PK Primary Key (DEPT_ID),
Constraint DEPT_NAME_UK Unique (DEPT_NAME),
Constraint DEPT_NAME_CK Check (DEPT_NAME in ('CS','IT','IS','DS'))
);
CREATE TABLE STUDENT
(
STUD_ID int Primary Key,
STUD_NAME varchar(30) Not Null,
DEPT_ID INT,
Constraint STUDENT_DEPT_ID_FK Foreign Key (DEPT_ID) References
DEPT (DEPT_ID)
);
ALTER TABLE STUDENT
ADD CONSTRAINT STUD_NAME_UK UNIQUE ( STUD_NAME);
ALTER TABLE STUDENT
DROP CONSTRAINT STUD_NAME_UK;
CREATE INDEX STUD_NAME_INDEX
ON STUDENT(STUD_NAME);
DROP INDEX STUDENT.STUD_NAME_INDEX;
CREATE VIEW SALES_REP AS
SELECT *
FROM employees
WHERE Title = 'Sales Representative'
CREATE VIEW SUPP_FOR_PROD AS
SELECT Products.ProductName,Suppliers.ContactName,Products.UnitPrice
FROM Products, Suppliers
WHERE Products.SupplierID = Suppliers.SupplierID
DROP VIEW SUPP_FOR_PROD;
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.