0% found this document useful (0 votes)
10 views4 pages

handling database ws1 answer key Computer (TCS)

The document is a reinforcement worksheet for a class on handling databases, featuring questions and answers related to database tables, primary keys, foreign keys, and data organization. It includes examples of a garden tools database and a property database, explaining the purpose of primary keys, data types, and the importance of forms and reports in database management. Additionally, it clarifies the differences between tables, records, and fields in a database.

Uploaded by

azrgamers14
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)
10 views4 pages

handling database ws1 answer key Computer (TCS)

The document is a reinforcement worksheet for a class on handling databases, featuring questions and answers related to database tables, primary keys, foreign keys, and data organization. It includes examples of a garden tools database and a property database, explaining the purpose of primary keys, data types, and the importance of forms and reports in database management. Additionally, it clarifies the differences between tables, records, and fields in a database.

Uploaded by

azrgamers14
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/ 4

The City School

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.

Code Description Price ($) Quantity_Stock Quantity_Ordered


GFLG Garden Fork 50.00 1 50
GSLG Garden Spade 50.00 11 0
GHLG Garden Hoe 45.00 8 0
HFSM Hand Fork 9.99 42 0
HSSM Hand Spade 9.99 40 0
HWSM Hand Weeder 9.99 11 0
HS20 Hose (20 metres) 45.00 10 0
HS35 Hose (35 metres) 60.00 2 0
HS50 Hose (50 metres) 75.00 20 60
YBLG Yard Brush 24.99 100 0
LMHD Lawn Mower 99.99 5 0
LMBT Lawn Mower (Battery) 249.99 7 0
LMPT Lawn Mower (Petrol) 349.99 10 25
TRBT Edge Trimmer (Battery) 79.99 15 0
TRPT Edge Trimmer (Petrol) 59.99 20 0
SHSM Shears 40.00 40 0
HCSM Hedge Clippers 40.00 45 0

(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.

Brochure Number of Number of Price in


Property Type Garden Garage $
No Bedrooms Bathrooms

Bungalow B17 7 4 Yes Yes 750,000

Apartment A09 2 1 No No 100,000

House H10 4 2 Yes No 450,000

House H13 3 2 Yes No 399,000

Apartment A01 2 2 No Yes 95,000


Apartment A16 1 1 No No 150,000

House H23 3 1 No Yes 250,000

House H46 2 1 Yes Yes 175,000

a)Give the number of fields that are in each record.


Ans: 7 fields
(b) State which field you would choose for the primary key.
Ans: Brochure No
Give a reason for choosing this field.
Ans: Uniquely identifies each property
(c) State the data type you would choose for each of the following fields.
Ans:
Garage ...................................................... Boolean

Number of Bedrooms ........... Number/Integer/Single

Price in $ .................. Number/Single/Real/Currency

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.

a) Why is it important to have a primary key in a database table?

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.

a) What are reports, and why are they useful in a database?

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.

Q6: Why is a database useful in organizing information?

Ans: A database is useful in organizing information because it provides a structured and


efficient way to store, retrieve, and manage data.

a) Explain the difference between a table, a record, and a field in a database.

Ans: - A table in a database is like a collection of related information, similar to a


spreadsheet. It has rows and columns to store data.
- A record is a single row in a table and contains all the information about one specific item or
entity, like one student or one product.
- A **field** is a single piece of information in a table, found in a column. It represents a
specific characteristic or attribute, like a student's name or a product's price.

You might also like