Professional Documents
Culture Documents
1. What are the following? Refer to ppt for the correct answers
a. Database
b. DBMS (with examples )
c. Table/ Relation
d. Tuple/ Rows/ Records
e. Fields/ Columns/ Attributes
f. Degree
g. Cardinality
h. Primary key
i. Candidate keys
j. Alternate keys
2. Full form of SQL, DDL, DML, DQL Refer to ppt for the correct answers
3. Classify the SQL commands into DML & DDL
a. Create database - DDL
b. Create table - DDL
c. Insert into - DML
d. Update - DML
e. Select - DML
f. Delete - DML
g. Drop table - DDL
h. Drop database - DDL
4. Name the SQL command for the following:
a. To list all existing databases
SHOW DATABASES;
b. To create a database XYZ
CREATE DATABASE XYZ;
c. To open database XYZ
USE XYZ;
d. To list all tables in the current database
SHOW TABLES;
e. To create a table
CREATE TABLE
f. To display the structure of a table
DESC
Page 1 of 11
g. To add a record in a table
INSERT INTO
h. To display records in a table
SELECT
i. To delete rows/records from a table
DELETE
j. To modify the existing data stored in a table
UPDATE
k. To delete a table ABC
DROP TABLE ABC;
l. To delete the database XYZ
DROP DATABASE XYZ;
6. Consider the table STUDENT given below and answer the questions
given below.
Table: STUDENT
RollNo AdmNo Name Place DOB Height House Percent
1 1778 Dona Kochi 2004-01-20 160.5 Blue 89
2 2344 Amit Delhi 2006-09-22 170.0 Red 94
3 8766 Ben Goa 2005-05-17 167.9 Blue 79
Page 2 of 11
4 8355 Mary Goa 2006-01-29 155.4 Green 88
5 7899 Bony Kochi 2006-11-07 175.6 Yellow 85
6 1566 Kary Goa 2004-01-23 164.0 Red 96
7. Write an SQL query for the following on the basis of STUDENT table:
a. Insert the first record
INSERT INTO STUDENT
VALUES (1,1778, ‘Dona’, ‘Kochi’, ‘2004-01-20’, 160.5, ‘Blue’, 89) ;
b. Display details of all students
SELECT * FROM STUDENT;
c. Display details of all students in the ascending order of name
SELECT * FROM STUDENT ORDER BY NAME;
d. Display details of all students in the descending order of percent
SELECT * FROM STUDENT ORDER BY PERCENT DESC;
e. Display roll number, name and house of all students
SELECT ROLLNO, NAME, HOUSE FROM STUDENT;
f. Display details of all students from Goa
SELECT * FROM STUDENT WHERE PLACE = ‘GOA’;
g. Display the names of blue house students from Goa
SELECT * FROM STUDENT WHERE HOUSE= ‘BLUE’ AND PLACE =
‘GOA’;
h. Display the list of different places
SELECT DISTINCT PLACE FROM STUDENT;
i. Display all students whose height is above 165
SELECT NAME FROM STUDENT WHERE HEIGHT > 165;
j. Display all students whose name starts with B
SELECT NAME FROM STUDENT WHERE NAME LIKE ‘B%’ ;
k. Display all students whose name ends with Y
SELECT NAME FROM STUDENT WHERE NAME LIKE ‘%Y’ ;
Page 3 of 11
l. Display all students with N in their name
SELECT NAME FROM STUDENT WHERE NAME LIKE ‘%N%’ ;
m. Display all students with 3 letter name starting with B
SELECT NAME FROM STUDENT WHERE NAME LIKE ‘B_ _ ’ ;
n. Change the house of Amit to Yellow
UPDATE STUDENT
SET HOUSE = ‘YELLOW’
WHERE NAME = ‘AMIT’;
o. Increase the percentage by 2%
UPDATE STUDENT
SET PERCENTAGE = PERCENTAGE + PERCENTAGE*2/100 ;
p. Reduce the percent by 1%
UPDATE STUDENT
SET PERCENTAGE = PERCENTAGE - PERCENTAGE*1/100 ;
q. Increase the height of all students by 1
UPDATE STUDENT
SET HEIGHT = HEIGHT + 1 ;
r. Remove the student with admission number 8355
DELETE FROM STUDENT WHERE ADMNO=8355;
8. Predict the output of the SQL Queries based on the table below:
Table: STUDENT
RollNo AdmNo Name Place DOB Height House Percent
1 1778 Dona Kochi 2004-01-20 160.5 Blue 89
2 2344 Amit Delhi 2006-09-22 170.0 Red 94
3 8766 Ben Goa 2005-05-17 167.9 Blue 79
4 8355 Mary Goa 2006-01-29 155.4 Green 88
5 7899 Bony Kochi 2006-11-07 175.6 Yellow 85
6 1566 Kary Goa 2004-01-23 164.0 Red 96
Page 4 of 11
b. SELECT * FROM STUDENT ORDER BY HEIGHT;
Name Height
Bony 175.6
Amit 170.0
Ben 167.9
Kary 164.0
Dona 160.5
Mary 155.4
Page 5 of 11
REVISION - PYTHON (30 Marks)
e. L = [2,4,6,8,10,20,18,16,14]
L.pop()
print(L)
L.pop(2)
print(L)
L.remove(10)
print(L)
del L[5]
print(L)
del L[2:6]
print(L)
Output :
[2,4,6,8,10,20,18,16]
[2,4,8,10,20,18,16]
[2,4,8,20,18,16]
[2,4,8,20,18]
[8,20,18]
f. L = [2,4,6,8,10,20,18,16,4]
print(20 in L)
print(16 not in L)
print(L.index(8))
print(L.count(4))
print(L.reverse())
print(L)
print(L.sort())
print(L)
print(L.sort(reverse=True))
print(L)
print(max(L), min(L))
Page 7 of 11
Output:
True
False
3
2
None
[4,16,18,20,10,8,6,4,2]
None
[2,4,4,6,8,10,16,18,20]
None
[20,18,16,10,8,6,4,4,2]
20 2
g. L = [2,4,6,8,10,20,18,16,14]
print(L[2:7])
print(L[7:2:-1])
print(L[::])
print(L[::-1])
print(L[0], L[-1], L[3])
Output :
[6,8,10,20,18]
[16,18,20,10,8]
[2,4,6,8,10,20,18,16,14]
[14,16,18,20,10,8,6,4,2]
2 14 8
Page 8 of 11
print(9 in X)
print(90 in X)
Output :
{9: 89, 4: 90, 10: 100, 20: 33, 11: 200, 12: 300}
{10:100, 11:200, 12:300}
90 33
True
False
Output :
75
{9:95, 4:90, 10:75, 20:33, 7:60 }
{}
0
Page 9 of 11
REVISION –
INTRODUCTION TO COMPUTER SYSTEM & EMERGING TRENDS
(10 Marks)
1. What are the following? Refer to ppt for the correct answers
a. Main memory or Primary memory or RAM
b. Auxiliary memory or Secondary memory
c. Hard copy
d. Soft copy
e. Data Recovery
f. Bit
g. Byte
h. Nibble
i. Artificial intelligence
j. Augmented Reality
k. Virtual Reality
l. Robotics
m. Big Data
n. IOT
o. Sensors
p. Cloud Computing
q. Grid computing
r. Blockchain technology
Page 10 of 11
Page 11 of 11