Professional Documents
Culture Documents
Databases - DDL, DML and Relationships Q& A
Databases - DDL, DML and Relationships Q& A
Foreign key is a field in one table that is also the primary key in another
table. The purpose of the foreign key is to ensure referential integrity of the
data. In other words, only those values that are supposed to appear in the
database are permitted.
1
Data manipulation involves:
• Retrieval of information from the database- SELECT statement
• Insertion of new information (records) into the database - INSERT
statement
• Deletion of information (records) in the database - DELETE statement
• Modification of information in the database - UPDATE statement
● Procedural: The user specifies what data is needed and how to get it
● Nonprocedural: The user only specifies what data is needed. This is
easier for the user but may not generate code as efficient as that
produced by procedural languages. (SQL- the code is not written)
6. In the given table: store, identify the data types for the various fields and
write an SQL statement to create the table.
item_no item qty rate lastbuy
2
104 Eraser Big 50 15.00 2018-12-14
7. Write the SQL command to create a table Movie with the following
structure:
Date_of_Release Date
Ticket_Rate Decimal
3
10. Define the term ‘Referential Integrity’.
● one to one (in this relationship, both the tables must have
4
primary key columns. )
5
Remove the Relationships:The relationships applied on the tables can be
removed also with the help of the Delete option. Right Click on the
relationship thread and select the Delete option.
13. What is data redundancy? How can you avoid redundancy in the tables?
Data redundancy is “duplication of data” in the database. It can be avoided
by designing the tables properly. Each row of table has to be uniquely
identified by the primary key.
6
● Cost of staff training.
3 The types of languages used for creating and manipulating the data in the
database are DML and DDL.
10
One to one relationship Primary key is needed in both
tables.
7
11 Create the following table for transport details.