Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
T6
1. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
ICT713 Advanced Database Design and Development
Tutorial 6
Topic: Database performance tuning, query optimization and Advanced SQL
Objective: Students learn about the Database performance tuning and write some
more SQL
Submission: Five minutes before the end of the tutorial word file containing student’s
answers need to be uploaded on Moodle
Part A: Answer the following questions:
1.
a. What is Referential Integrity?
It the concept relatedto database in which all foreignkeysshould
check with the primary keywhich shouldbe indicatedto foreignkey.
b. What isData independence?
Data independence isaterm that is relatedto data
transparency that is linkedto centralizedDBMS and givesto immunity to the user
to make changes in the data.
2. How can a table be deletedfromthe database?Provideanexample.
Use the DELETE statementwithoutspecifyingaWHERE clause.Withsegmentedtable
spaces,deletingall rowsof a table isveryfast....
Use the TRUNCATE statement.The TRUNCATEstatementcanprovide the following
advantagesovera DELETE statement:...
Use the DROP TABLE statement.
DELETE FROMCustomersWHERE CustomerName='AlfredsFutterkiste';
Part B:
Considerthe followingrelational schema:Questions 1-8 are basedonreferential integrity.
Table Name Attributes
2. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
Emp (eid: integer, ename: string, age: integer, salary: real,did: integer)
Works (eid: integer, did: integer, ptime: integer)
Dept (did: integer, dname: string, budget: real, managerid: integer
Example: to CREATE TABLE Command with constraints
CREATE TABLE Emp(
eid int NOT NULL PRIMARY KEY,
age int NOT NULL,
……………………………..
did int FOREIGN KEY REFERENCES Dept(did)
);
1. Write SQL statements to create Dept relation. Note: did is the primary key (not null).
Hint: use CREATE TABLE Command with constraints
CREATE TABLE Dept
did INTEGER,
dhame STRING,
budget REAL,
managerid INTEGER,
PRIMARY KEY (did) ON DELETE SET NULL
2. Define the DeptrelationinSQLsothat everydepartmentisguaranteedtohave amanager.
CREATE TABLE Dept ( did INTEGER,
budget REAL,
managerid INTEGER NOT NULL ,
PRIMARY KEY (did),
FOREIGN KEY (managerid) REFERENCES Emp)
3. Enter followinginformationintoDepttable.
did dname budget managerid
3 Finance 2000.50 6
4 Administration 5000.70 7
INSERT
INTO Dept(did,dname,budget,managerid)
VALUES (3, ‘finance’,2000.50, 6)
3. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
VALUES (4, ‘administration’,5000.70, 7)
4. Write SQL statementstocreate Emp relation.
a. Addthe FOREIGN KEY that will relate the DEPTtable tothe EMP table.
CREATE TABLE Emp(
Eid INTEGER NOT NULL,
Did INTEGER NOT NULL,
pcttime INTEGER,
PRIMARY KEY (eid, did),
UNIQUE(eid),
FOREIGNKEY (did) ReferencesDept)
Create TABLE Emp
On DELETE
{cascade, set default,setnull,no action}
b. Include appropriate versionsof all primaryandforeignkeyintegrityconstraints.
CREATE TABLE Emp(
Eid INTEGER,
Ename CHAR(10),
Age INTEGER,
Salary REAL,
PRIMARY KEY (eid))
CREATE TABLE WORKs(
Eid INTEGER,
Did INTEGER,
Pcttime INTEGER,
PRIMARY KEY (eid,did),
FOREIGNKEY(did) REFERENCES Dept,
FOREIGNKEY (eid) REFERENCES EMP,
On DELETE CASCADE)
5. Enter followinginformationintoEMP table
Eid Ename Age Salary did
1006 Peter Miller 40 4000.90 3
1007 David John 30 5000.80 3
1008 Kevin Studd 29 6000.70 4
INSERT
INTO Emp (eid,ename,age, salary, did)
4. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
VALUES (1006, ‘petermiller’,40, 4000.90, 3)
VALUES (1007, ‘david john’,30, 5000.80, 3)
VALUES (1008, ‘kevinstudd’, 29, 6000.70, 4)
6. Can you insert following record into EMP table?
Eid Ename Age Salary did
1008 Cathy Simon 35 5000.80 5
NO, we cannot insert record into EMP table.
7. If you cannot insert, give an explanation why you couldn’t.
We cannot because EID is already taken by other person.
8. Delete department 3 from the DEPT table using the following command
a. DELETE FROMDept WHERE did=3;
DELETE
FROM dept
WHERE did=’3’
b. Explain what happens to EMP table when this statement is executed.
The UPDATE statement changes the values of specified columns in one or more rows in a table or
view.For a full descriptionof the UPDATE statement,see Oracle Database SQL Reference.Another
(usually short) name for the referenced table or view, typically used in the WHERE clause.
5. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
9. Create formsto enterdata foreach of the tables.
Forms in Accessare like display cases instores that make it easierto viewor get the itemsthat
you want. Since forms are objectsthrough which you or other users can add, edit,or displaythe
data storedin your Access desktopdatabase, the designof your form is an important aspect. If
your Access desktopdatabase is going to be usedby multiple users,well-designedformsis
essential forefficiencyanddata entry accuracy.
There are several ways of creating a form in an Access desktopdatabase and thisarticle points you
to some of the common ways.
10. Create any twosample reportsbasedonthe database.
As always, we’ll have to take a look at the data model we’re using. Ifyou’re a data analyst, some
of the expectedtasksyou can expectare – grab the data from the database, create a report, draw
conclusionsfrom the report data. Therefore,you can expectthat you’ll have a data model at your
disposal.
SQL queries- the data model we'll use in the article
In such a data model,you should identifythe tablesthat contain data neededinthe report. Also,
you’ll needto be sure how these tables are related.You shouldask yourselfquestionslike:
Whichtablesare dictionariesand whichones are beingpopulatedwith data (eitherby
users/customers,eithersome automated process)? -> You’re interestedinanalyzing data
from tablesbeingpopulatedwith the data while dictionariesare here to displayinfoon
the screen(whenthe data is beinginserted+ used a category in reports)
Does table X always have a relatedrecord in table Y? -> Maybe there always is a record in
the relatedtable,but that doesn’tneedto be the case always. This will be important when
you decide to use INNER JOIN (ifyou always have a relatedrecord) or LEFT JOIN (ifyou
don’t always have a relatedrecord) whenjoiningthese two tables
Part C:
WeeklylogforDatabase projectassessment:
6. Questions extracted from: Coronel, C. and Morris, S. (2018). Database Systems: Design, Implementation, & Management, 13 th Edition., Cengage Learning
ICT713: Tutorial 6 CompiledBy:DivyaLeekha 06NOV2020
No. Criteria Activity
1 Attendance at
weekly meeting
Convey information through telephone and social media, for
example, WhatsApp group used to exchange notes from
tutorials, other documents, and pictures for the assigned tasks
and Zoom meetings for discussions.
2 Weekly activity log After creating the ERD model, the next step was to design the
EERD for the enterprise.
3 Time management It took me 30 minutes to design the EERD for the enterprise.
4 Tasks Designed an Enhanced Entity Relationship Diagram which
represents the database entities and their attributes.
5 Actual contribution
to group project
Creation of EERD model which
includes subclasses and superclasses,
Specialization & Generalization,
Attribute & Relationship Inheritance.
Creation of EERD models through MS
Access.