Professional Documents
Culture Documents
Date:26/02/2020
Marks:50 M
PRN NO:______________________
Instructions:
1. All questions are compulsory.
2. Only one selection will get considered.
3. Types answer of MCQ in answer block.
4. Upload PDF File of answers on moodle.
1 The _________ provides a set of operations that take one or more relations as input and return a
relation as an output.
a) Schematic representation
b) Relational algebra
c) Scheme diagram
d) Relation flow
3. Here which of the following displays the unique values of the column?
SELECT ________ dept_name
FROM instructor;
a) All
b) From
c) Distinct
d) Name
4. The query given below will not give an error. Which one of the following has to be replaced to get
the desired output?
SELECT ID, name, dept name, salary * 1.1
WHERE instructor;
a) Salary*1.1
b) ID
c) Where
d) Instructor
6. ’_ _ _ ’ matches any string of ______ three characters. ’_ _ _ %’ matches any string of at ______
three characters.
a) Atleast, Exactly
b) Exactly, Atleast
c) Atleast, All
d) All, Exactly
7. SELECT instructor.*
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
8. (SELECT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009)
EXCEPT
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);
Type: Drawing.
1. Write a query in SQL to find the ID number for the actor whose first name
is 'Woody' and the last name is 'Allen'
Sample table: actor
act_id | act_fname | act_lname | act_gender
--------+----------------------+----------------------+------------
101 | James | Stewart | M
102 | Deborah | Kerr | F
103 | Peter | OToole | M
104 | Robert | De Niro | M
105 | F. Murray | Abraham | M
106 | Harrison | Ford | M
107 | Nicole | Kidman | F
108 | Stephen | Baldwin | M
109 | Jack | Nicholson | M
110 | Mark | Wahlberg | M
111 | Woody | Allen | M
112 | Claire | Danes | F
113 | Tim | Robbins | M
114 | Kevin | Spacey | M
115 | Kate | Winslet | F
116 | Robin | Williams | M
117 | Jon | Voight | M
118 | Ewan | McGregor | M
119 | Christian | Bale | M
120 | Maggie | Gyllenhaal | F
121 | Dev | Patel | M
122 | Sigourney | Weaver | F
123 | David | Aston | M
124 | Ali | Astin | F
2.
3. Perform Full outer join on following tables.
Sample table: foods
+---------+--------------+-----------+------------+
| ITEM_ID | ITEM_NAME | ITEM_UNIT | COMPANY_ID |
+---------+--------------+-----------+------------+
| 1 | Chex Mix | Pcs | 16 |
| 6 | Cheez-It | Pcs | 15 |
| 2 | BN Biscuit | Pcs | 15 |
| 3 | Mighty Munch | Pcs | 17 |
| 4 | Pot Rice | Pcs | 15 |
| 5 | Jaffa Cakes | Pcs | 18 |
| 7 | Salt n Shake | Pcs | |
+---------+--------------+-----------+------------+
Sample table: company
+------------+---------------+--------------+
| COMPANY_ID | COMPANY_NAME | COMPANY_CITY |
+------------+---------------+--------------+
| 18 | Order All | Boston |
| 15 | Jack Hill Ltd | London |
| 16 | Akas Foods | Delhi |
| 17 | Foodies. | London |
| 19 | sip-n-Bite. | New York |
+------------+---------------+--------------+
4. We have the following two tables 'student' and 'marks' with common field
'StudentID'.
student marks
write a query to identify all students who get better marks than that of the student
who's StudentID is 'V002', but we do not know the marks of 'V002'.
5. Create a view of a table actor with attributes act_id and act_fname and
display all the values of view.
6.
Create table with name Persons having attributes ID, FirstName,
LastName and Age. After creating table add primary key constraint to
ID.
+---------+----------+-----+-----------+----------+
| ROLL_NO | NAME | AGE | BRANCH | CITY |
+---------+----------+-----+-----------+----------+
| 10001 | Kate | 22 | CSE | Mumbai |
| 10002 | Richard | 21 | ECE | Delhi |
| 10003 | Rick | 33 | ME | Chennai |
| 10004 | Peter | 26 | CSE | Delhi |
| 10005 | Steve | 22 | CSE | Noida |
| 10006 | Mark | 22 | ECE | Jaipur |
| 10007 | Brad | 23 | ME | Rampur |
+---------+----------+-----+-----------+----------+
SQL statement will fetch all the records from the table “STUDENT” and the
returned rows will be in ascending order of student age in ascending order.
10. write an SQL statements to fetch the name of the students where
student age is “greater than 23” and address is “Delhi”
Type : Oral.