Unit 3 Notes DBMS
Unit 3 Notes DBMS
Unit 3 Notes DBMS
4. Consider the table given below and answer the questions that follows:
Table : Library
Book_Id Book Name Author Name Price Publisher
F001 Pride and Jane Austen 550 ABC
Prejudice
S004 Amazing E. Shane 1050 ABC
Astronomy
C005 IT and MHA Diwaan 2500 HYM
Mankind
a) Name the field in the given table.
Ans: Book_Id, Book Name, Author Name, Price, Publisher
b) Which field should be made the primary key?
Ans: Book_Id should be made as primary key because it identifies each
record in a table uniquely.
c) Is there any alternate key in the table?
Ans: Book Name field can be an Alternate key in the given table.
d) How is primary key different from foreign key? Explain with example.
Ans:
Primary Key Foreign Key
Primary Key is used to identify the A foreign key establishes a
records in a table uniquely. relationship between tables by
referencing the primary key of
another table.
The field designated as Primary It can contain duplicate values.
Key must contain Unique Values
It cannot contain Null values. It can contain NULL values.
A table can have only one Primary A table can have more than one
key. Foreign key.
Example:
Table: Student
Foreign Key
Roll No Name Stream_Code
1 Neha S101
2 Nisha S102
3 Soniya S103
4 Pooja S101
5 Priya S102
Primary Key
Table: Stream
Stream_Code Stream_Name
S101 Humanities
S102 Commerce
S103 Non_Medical
*********************
1. Differentiate between:
a) Memo and Varchar data type
Memo Varchar
Memo is used to store some It is used for relatively short
descriptive data. entries.
It can store more than 255 Varchar stores upto the
characters. Memo data type specified length. The number of
allows to store data up to 64,000 bytes allocated depend on the
characters. number of characters entered
by the user.
b) Number and Decimal
Ans:
Number Decimal
Number data type is used to Decimal data type includes
store integers or whole decimal places. Making it ideal
numbers. for financial calculations or any
calculation requiring precision.
Ans: every table must have a primary key that uniquely identifies a
record in the table. To make a particular field as the primary key, place
the mouse pointer before the field name, and right click. A pop-up menu
appears. Select the Primary key option from pop up menu. A key icon
appears before the field name indicating that it is a primary key.
Ans: Step 1: Open the table in datasheet view and select the primary key
field which you want to sort.
Step 2: From the toolbar click Sort Descending icon to sort in descending
order of selected field.
Step 3: The table will be sorted in the descending order of primary key.
Example:
One –to-One
Table : Student Details
Table: Student_Result
**********************
3. What all information is seen in the overview ( last step of the Query
wizard?
Ans: The last step of the Query wizard displays the entire Overview of
the query. It includes the following
a) Name of the Query - If desired, type the new name in the text
box.
b) The action to be performed after the wizard finishes - By default
Display Query option will be selected. Click and select the Modify
Query radio button if the query has to be edited in the Design
view.
c) Complete detail of the query: This section contains a summary
about the query that has been created.
4. What is the use of Alias row in the Design grid of the Query Design
window?
Ans: Alias row is used to display meaningful names in the output. An
Alias is an alternative name for a field in a query.