Professional Documents
Culture Documents
Syntax
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition;
Note: The database does not store the view data! The database engine recreates the data, using
the view's SELECT statement, every time a user queries a view.
24. CREATE VIEW CUSTOMERS_VIEW AS
SELECT name, age
FROM CUSTOMERS;
25. ALTER TABLE CUSTOMERS ADD SEX char(1);
26. ALTER TABLE CUSTOMERS DROP SEX;
27. TRUNCATE TABLE CUSTOMERS;
Exercise
ssn, with salary and phone as attributes), departments (identified by dno, with
dname and budget as attributes), and children of employees (with name and age as
uniquely by name when the parent (who is an employee; assume that only one
Identify the possible entities and attributes for each entities of the company
Draw an Entity Relationship Diagram (ERD) using chen model for the
identified entities using Microsoft Visio and Put cardinality of relationship
on the complete diagram that captures this information.
Salary
Phone Dno
Dname
HAS
Budget
Nzme CHILD
Draw an Entity Relationship Diagram (ERD) using crow's feet model for
PK SSN PK DNO
SALARY DNAME
PHONE BUDGET
FK1 SSN
CHILD
PK NAME
PK,FK1 SSN
Create a SQL statements that creates the tables and Insert those records