Fundamentals of Database Systems (6 Edition)
Fundamentals of Database Systems (6 Edition)
(6th Edition)
Lectured by
Daw Honey Htun
Assistant Lecturer (Ph.D, Thesis)
Department of Computer Engineering and Information Technology
Data Definition, Constraints, and
Schema Changes
OR
Example:
ALTER TABLE EMPLOYEE ADD JOB VARCHAR(12);
The database users must still enter a value for the new attribute JOB
for each EMPLOYEE tuple.
This can be done using the UPDATE command.
INTERVAL:
– Specifies a relative value rather than an absolute value
A query that refers to two or more attributes with the same name
must qualify the attribute name with the relation name by prefixing
the relation name to the attribute name
Example:
EMPLOYEE.LNAME, DEPARTMENT.DNAME
Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright © 2004 Pearson Education, Inc.
Some queries need to refer to the same relation twice
Query 8: For each employee, retrieve the employee's name, and the name
of his or her immediate supervisor.
Q1C: SELECT *
FROM EMPLOYEE
WHEREDNO=5;
Q1D: SELECT *
FROM EMPLOYEE, DEPARTMENT
WHEREDNAME='Research' AND
DNO=DNUMBER;
Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright © 2004 Pearson Education, Inc.
QL does not treat a relation as a set; duplicate tuples can appear
eliminate duplicate tuples in a query result, the keyword
ISTINCT is used
USE OF DISTINCT
or example, the result of Q11 may have duplicate SALARY values
hereas Q11A does not have any duplicate values
Query 28: Retrieve a list of employees and the projects each works in,
ordered by the employee's department, and within each department ordered
alphabetically by employee last name.