Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

INFORMATICS PRACTICES, 2023-24

ASSIGNMENT – 3
1. In the table “Student”, Priya wanted to increase the Marks(Column Name:Marks) of those
students by 5 who have got Marks below 33. She has entered the following statement:

SELECT Marks+5 FROM Student WHERE Marks<33;


Identify errors(if any) in the above statement. Rewrite the correct SQL statement.
2. (i) Name the Data type that should be used to store AccountCodes like “A1001” of
Customers.
(ii) Name two Data types that require data to be enclosed in quotes.
3. Given the table ‘Player’ with the following columns :

Write the output of the following statements:


(i) SELECT AVG(POINTS) FROM Player;
(ii) Select COUNT(POINTS) FROM Player;
4. Name SQL Single Row functions (for each of the following) that
(i) Returns a number.
(ii) Returns lowercase letters.
(iii) Returns names of days. For example: “Monday “, “Tuesday”.
(iv) Returns weekday number. For example : 1 for Sunday , 2 for Monday , 3 for Tuesday.
5. Consider the following tables PATIENT and TEST and answer the questions that follow:

Note :
NAME holds the Names of patients.
DTADMIT holds Dates on which patient was admitted to hospital.
TESTID holds Ids of Medical tests done on patients.

(i) Name the Primary keys in both the tables and foreign key in ‘ PATIENT’ table.
State the reason for your choice.

ASSIGNMENT – 3 AIR FORCE SCHOOL JORHAT Page 1 of 3


INFORMATICS PRACTICES, 2023-24
(ii) To display Names of Patients, TESTID and Test names for those Patients who
were admitted between ‘01-DEC-2017’ and ‘15-DEC-2017’ (both dates inclusive).

(iii) To display Names of Patients, Test names and Cost of Test for those Patients who
have “Sharma” in their names.
(iv) To increase the cost of those tests in the table “ TEST ” by ` 50.00 that have cost
below ` 200.00
6. In CHAR(10) and VARCHAR(10) , what does the number 10 indicate?
7. ‘Employee’ table has a column named ‘CITY’ that stores city in which each
employee resides. Write SQL query to display details of all rows except those rows
that have CITY as ‘DELHI’ or ‘MUMBAI’ or ‘CHANDIGARH’.
8. Consider the following table : [AI, 2019, 1 Mark]

Abhay wants to know the number of students who took the test. He writes the
following SQL statement to count STUDENTID without duplicates. However the
statement is not correct. Rewrite the correct statement.
SELECT DISTINCT (COUNT STUDENTID) FROM RESULTS;
9. Table student has the columns RNO and SCORE. It has 3 rows in it. Following two
SQL statements were entered that produced the output (AVG(SCORE) as 45 and
COUNT(SCORE) as 2):
(i) AVG(SCORE)
(ii)COUNT(SCORE )
Data in SCORE column is same in two rows. What data is present in the SCORE
column in the three rows ?
10. Consider the following tables PARTICIPANT and ACTIVITY and answer the questions
that follow:

ASSIGNMENT – 3 AIR FORCE SCHOOL JORHAT Page 2 of 3


INFORMATICS PRACTICES, 2023-24

(i) When the table “PARTICIPANT” was first created, the column ‘NAME’ was
planned as the Primary key by the Programmer. Later a field ADMNO had
to be set up as Primary key. Explain the reason .

(ii) Identify data type and size to be used for column ACTIVITYCODE in table
ACTIVITY.

(iii) To display Activity Code along with number of participants participating in


each activity (Activity Code wise) from the table Participant.
(iv) How many rows will be there in the Cartesian Product of the two tables in
consideration here ?
(v) To display Names of Participants , Activity Code, Activity Name in
alphabetic ascending order of names of participants.
(vi) To display Names of Participants along with Activity Codes and Activity
Names for only those participants who are taking part in Activities that
have ‘bag’ in their Activity Names and Points of activity are above 250.

ASSIGNMENT – 3 AIR FORCE SCHOOL JORHAT Page 3 of 3

You might also like