0% found this document useful (0 votes)
124 views3 pages

G 12 CS Day 2

NT

Uploaded by

kishorej1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views3 pages

G 12 CS Day 2

NT

Uploaded by

kishorej1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

VELAMMAL NEW GEN EDU – NETWORK

Grade – 12 Computer Science

Model-1 RevisionWorksheet

DAY-2_19-09-2024 Chapter-Database concepts and Interface python with MySql

SECTION A (1 MARK)
1. Write the SQL command that is used to permanently save all changes made by the
current transaction to the database.
2. Which command is used to delete the records of the table.
3. command is used to modify or change the definition of already existing
schema objects
4. Write the SQL command that is used to modify a tuple in a table.
5. command will retrieve the information stored in the database.
6. key is called as non -key attribute,
7. The term is used to refer to a record in a table.
(a) Attribute (b) Tuple (c) Field (d) Instance
8. Which of the following is not a legal sub-language of SQL?
(a) DDL (b) QAL (c.) DML (d) TCL
9. Which command is used to remove a relation from an SQL?
(a) Drop table (b) Delete (c) Delete table (d) Remove
10. Which is the following not a DML command ?
(a) SELECT (b) UPDATE (c) DELETE (d) CREATE

SECTION B (2 MARK)
11. Give an example of a table which has one Primary key and two alternate keys. How
many Candidate keys will this table have?
12. Write the difference between alternate key and Primary key.
13. If a table Books has columns BookID, ISBN, Title, and Author, where BookID is the
Primary Key and both ISBN and Title are unique, what are the Alternate Keys and how
many candidate keys for this table?
14. Consider the table BorrowRecords has columns RecordID, MemberID, BookID are
unique column and BorrowDate.
i) what is the degree and cardinality of the table
ii) Which columns are eligible to become a primary key
15. What is data redundancy and data inconsistency.

16. Create a table named courses with the following specifications:

 course_id (Integer, Primary Key)


 course_name (Varchar of length 100, Not Null)
 credits (Integer, Not Null)
 department (Varchar of length 50)

Ensure that course_name should be unique.


SECTION C (4 MARK)
17. A table, named STATIONERY, in ITEMDB database, has the following structure:
Field Type
itemNo Int(11)
Itemname Varchar(15)
Price Float
Qty Int(11)
Write the following Python function to perform the specified operation:
AddAndDisplay(): To input details of an item and store it in the table STATIONERY.
The function should then retrieve and display all records from the STATIONERY table
where the Price is greater than 120.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: Pencil
18. Write a Python function named DeleteCustomer() that connects to a MySQL database
and deletes a record from the CUSTOMERS table based on the cus_ID provided by
the user.
Field Type
Cus_id Int(7)
Cus_name Varchar(15)
Pro_name Varchar(20)
Price int

19. Write a Python function named UpdateBookPrice() that connects to a MySQL database
and updates the price of a book in the BOOKS table based on the ISBN provided by the
user. Retrieve all the records from the table after updating.

Field Type
Book_name Varchar(20)
ISBN Int(11)
Edition Varchar(20)
Price Int(11)

20. A departmental store MyStore is considering to maintain their inventory


using SQL to store the data. As a database Administrator, Abhay has decided
that: Name of the database–mystore
Name of the table –STORE
The attributes of STORE are as follows
ItemNo –numeric
ItemName–character of size 20
Scode – numeric
Quantity– numeric
Table : STORE
ItemNo ItemName Scode Quantity
2005 SharpnerClassic 23 60
2003 BallPen0.25 22 50
2002 GelPenPremium 21` 150
2006 GelPenClassic 21 250
2001 EraserSmall 22 110
2004 EraserBig 22 220
2009 BallPen0.5 21 180

i) dentify the attributes suitable to be declared as primary key


ii) Abhay wants to remove the table STORE from the database MyStore,
Help Abhay in writing the command for removing the table STORE from the
database MyStore.
iii) Abhay wants to ADD a new column price with data type as decimal.
Write the query to add the column.
iv) Now Abhay wants to remove a column price from the table STORE.Write
the query.

You might also like