handling database ws1 answer key Computer (TCS)
handling database ws1 answer key Computer (TCS)
Liaquat Campus
Reinforcement worksheet class6
Topic: Handling Database answer key
Name: ____________________________ Sec: ____ Date: ___________
Q1. A garden centre sells garden tools and stores details of these in a database table named TOOLS.
Code is the primary key in the TOOLS table.
(a) State the purpose of the primary key in the TOOLS table.
Ans: The primary purpose of a primary key in a database is to uniquely identify each record or
row in a table. It ensures that there are no duplicate entries and enables efficient data retrieval
and management.
(b) List the output from the data shown in the table TOOLS that would be given by this query-by-
example.
Field:
Code Description Price ($) Quantity_Stoc Quantity_Ordered
k
Table:
TOOLS TOOLS TOOLS TOOLS TOOLS
Sort: Descending
Show:
Criteria:
>40 >0 >0
Or:
Ans:
It would display all the fields (Code, Description, Quantity_Ordered) for the quantity records in
descending order, Based on the criteria where price is greater than 40, the quantity ordered is greater
than 0
(c) Complete the query-by-example grid to output the tools where the quantity in stock is below 25.
Only show the Code, Description, and Quantity Stock fields in ascending order of Code.
Field:
Code Description Price ($) Quantity_Stoc Quantity_Ordered
k
Table:
TOOLS TOOLS TOOLS TOOLS TOOLS
Sort: Ascending
Show:
Criteria:
>40 >0 >0
Or:
Q2. A database, PROPERTY, was set up to show the prices of properties for sale and the
features of each property. Part of the database is shown below.
Q3: John is working on creating a database for a car rental company. He wants to ensure that
each vehicle in the database can be uniquely identified. How can he use a primary key to
achieve this?
Ans: John can use a primary key in the car rental company's database by assigning a unique
identifier, such as a vehicle identification number (VIN) or a registration number, to each
vehicle. This primary key ensures that no two vehicles share the same identifier, guaranteeing
each vehicle's unique identification in the database.
Ans: primary key is essential in a database table to ensure each record has a unique identifier,
facilitating data retrieval and maintaining data integrity.
b)What role does a foreign key play in establishing relationships between tables in a database?
Ans: A foreign key links records in one table to the primary key of another table, establishing
relationships and enforcing referential integrity in a database.
c) Sarah is designing a database for a school, where students are associated with specific
courses. She wants to ensure that each student's enrolment is properly linked to the
corresponding course. How can she use foreign keys to achieve this?
Ans: Sarah can use foreign keys by adding a course ID from the "courses" table as a foreign
key in the "students" table, linking each student's enrollment to a specific course.
Q5: What is the purpose of using forms in a database? How can forms simplify data entry for
users?
Ans: Forms in a database make it easier for users to enter and edit data by providing user-
friendly, organized layouts, reducing the need to work directly with complex tables.
Ans: Reports in a database are like well-organized summaries of data. They are useful
because they help people see and understand information from the database in a clear and
structured way, making it easier to make decisions and share information.