You are on page 1of 3

Practical Exam - SE1507 - 03/19/2021

Họ và tên: …………………………… MSSV:………………

I. Queries in SQL:
1. List name and gender of stars that appeared in the movie 'Star Wars'.
select name, gender from MovieStar where name IN (select starName from StarsIn where movieTitle LIKE
'Star Wars' )

……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
………………………………………………………………………………………………….
2. List all the titles and years of the movies that have appeared in the Movies but have not
been mentioned in StarsIn relation.
……select title, year from dbo.Movies
except
select movieTitle, movieYear from dbo.StarsIn

……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………….
3. Find title of movies that are no longer than “Empire Strikes Back”.
……… select title from dbo.Movies where len(title) < len('Empire Strikes Back')

……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
…………………………………………………………………………………………….

II. Database Modifications


4. Add the following information to the dbo.Movies table.

Movie Kickboxer - Retaliation


Year 2018
Running time 141 minutes
Genre Action
ProducerC# 139 (Dimitri Logothesis)
Distributed by Well Go USA
… insert into dbo.MovieExec (cert#) values(139)
insert into dbo.Studio (name,presC#) values('Dimitri Logothesis', 139)
insert into dbo.Movies (title,year,length,genre,producerC#,studioName) values('Kickboxer -
Retaliation', 2018, 141, 'action', 139, 'Well Go USA')

……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
…………………………………………………………………………………………………

5. Delete the movie 'Star Wars', 1977 from the dbo.Movies table.

……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………

III. Identify E/R Model with Chen's notations


6. P&S is a construction contractor specializing in medium-priced town homes. Its
employees sometimes work on multiple projects at the same time. However, equipment is
assigned to only one project at a time.

1. Equipment………………………………………………………………………………….
2. Project…………………………………………………………………………….
3. Employee………………………………………………………………………………….
4. Assign……………………………………………………………………………….
5. Many………………………………………………………………………………………….
6. One………………………………………………………………………………………….
7. Work………………………………………………………………………………………….
8. Many………………………………………………………………………………………….
9. Many………………………………………………………………………………………….

You might also like