projecting the literal 'hi' for table dept

'H                                                                              
--                                                                              
hi                                                                              
hi                                                                              
hi                                                                              
hi                                                                              
hi                                                                              
hi                                                                              

6 rows selected.

dept_num concatenated with dept_name:

DEPT_NUM||DEPT_NAM                                                              
------------------                                                              
100Accounting                                                                   
200Research                                                                     
300Sales                                                                        
400Operations                                                                   
500Management                                                                   
600Computer Sci                                                                 

6 rows selected.

what if I concatenate a literal ' - ' between dept_num and dept_name?

DEPT_NUM||'-'||DEPT_N                                                           
---------------------                                                           
100 - Accounting                                                                
200 - Research                                                                  
300 - Sales                                                                     
400 - Operations                                                                
500 - Management                                                                
600 - Computer Sci                                                              

6 rows selected.

how about adding a column alias:

Departments                                                                     
---------------------                                                           
100 - Accounting                                                                
200 - Research                                                                  
300 - Sales                                                                     
400 - Operations                                                                
500 - Management                                                                
600 - Computer Sci                                                              

6 rows selected.

projecting department data in comma-separated/CSV format:

DEPT_NUM||','||DEPT_NAME||','||DEPT_L                                           
-------------------------------------                                           
100, Accounting, New York                                                       
200, Research, Dallas                                                           
300, Sales, Chicago                                                             
400, Operations, Boston                                                         
500, Management, New York                                                       
600, Computer Sci, Arcata                                                       

6 rows selected.

names of departments located in Chicago or Dallas:

DEPT_NAME                                                                       
---------------                                                                 
Research                                                                        
Sales                                                                           

adding a Computer Sci row to dept
insert into dept
*
ERROR at line 1:
ORA-00001: unique constraint (ST10.SYS_C00876465) violated 


project the locations and names of departments
with employees

(for each department, do any employees
EXIST for that department?)

DEPT_LOC        DEPT_NAME                                                       
--------------- ---------------                                                 
New York        Accounting                                                      
Dallas          Research                                                        
Chicago         Sales                                                           
Boston          Operations                                                      
New York        Management                                                      

which departments have NO employees?

DEPT_LOC        DEPT_NAME                                                       
--------------- ---------------                                                 
Arcata          Computer Sci                                                    

OOPS, left off correlation condition with NOT EXISTS!
(you might think it means all departments have employees,
but Computer Sci department does not)

(this will show no rows selected,
even though Computer dept has no employees...)

no rows selected

OOPS, left off correlation condition with EXISTS!
(you might think it means all departments have employees,
but Computer Sci department does not)

(this will also select Computer Sci dept,
even though Computer Sci dept has no employees...)

DEPT_LOC        DEPT_NAME                                                       
--------------- ---------------                                                 
New York        Accounting                                                      
Dallas          Research                                                        
Chicago         Sales                                                           
Boston          Operations                                                      
New York        Management                                                      
Arcata          Computer Sci                                                    

6 rows selected.

OOOPS, this will not work,
inner select has a join condition
NOT a correlation condition
(might THINK it says all departments have employees,
but Computer Sci department does not)

no rows selected

using the HW 4 database,
which client(s) have rented
BOTH 'Gone with the Wind' and 'Star Wars'?

Windy Starry Client(s)                                                          
--------------------------------                                                
Beta, Edie                                                                      

double-check: what movies has Edie Beta rented?

MOVIE_TITLE                                                                     
----------------------------------------                                        
Star Wars                                                                       
Gone with the Wind                                                              
Indiana Jones and the Temple of Doom