Quick tips Flashcards
1
Q
When doing union , except , intersect operations :
. same number of attributes
. corresponding attributes have same domain
Use aliases to ensure attrbutes you want to union have same name( eg if you had pharmacy(name), pharmacy_name) change one of them so that the names are the same
Example on back of flashcard
A
(SELECT SSN
FROM EMPLOYEE)
EXCEPT
(SELECT ESSN as SSN <— - alias used to ensure same name
FROM WORKS_ON
WHERE PNO=1)
2
Q
INSERT INTO <table name>
VALUES <tuple></tuple>
A
INSERT INTO EMPLOYEE
VALUES (‘Richard’,’K’,’Marini’,’653298653’,
‘30-DEC-52’,’98 Oak Forest,Katy,TX’,
‘M’, 37000,’987654321’, 4)
same order as attributes in table
3
Q
A