SlideShare a Scribd company logo
1 of 16
SECTION D
2)Display the item number and total cost for each order line
(total cost = no of items X item cost). Name the calculated
column TOTAL COST.
Answer:
SELECT item_number, no_of_items * item_cost “TOTAL
COST”
FROM ORDER_LINE
4)Display the order number and client number from the ORDER
table. Output the result in the format. Client <clientno> ordered
<orderno>
Answer:
SELECT ‘Client ‘+ clientno+’ordered ‘+ orderno AS result
FROM ORDER
6)Display the client name and order date for all orders using the
traditional method.
Answer:
SELECT name, order_date
FROM
CLIENT c INNER JOIN ORDER o
ON (c.clientno = o.clientno);
7)Repeat query (7) but also display all clients who have never
ordered anything.
Answer:
SELECT name, order_date
FROM
CLIENT c LEFT OUTER JOIN ORDER o
ON (c.clientno = o.clientno);
8) Display the client name and order date for all orders using
the natural join keywords.
SELECT name, order_date
FROM
CLIENT NATURAL JOIN ORDER;
9) Display the client name and order date for all orders using
the JOIN . . . USING method.
SELECT name, order_date
FROM CLIENT c JOIN ORDER o
USING (clientno);
10) Display the client number, order date and shipping date for
all orders where the shipping date is between three and six
months after the order date.
SELECT clientno, order_date, shipping_date
FROM
CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND shipping_date BETWEEN
ADD_MONTHS(shipping_date,3) AND
ADD_MONTHS(shipping_date,6);
16) Display the order number, order line number and the
shipping date. If the shipping date is null, display the string
<not shipped yet>.
SELECT orderno, order_line_number, NVL(shipping_date,’<not
shipped yet>’)
FROM ORDER_LINE
18)Display the clientno and total value for all orders placed by
that client. Output the result in the following format: Client
<clientno> has placed orders to the value of <total value>
SELECT ‘Client ‘+clientno+’ has placed order to the value of
‘+ SUM(no_of_items*item_cost)
FROM ORDER_LINE
GROUP BY clientno
19) Display all clients whose name begins with the letter J or
contains the letter M anywhere or contains E as the third letter.
SELECT *
FROM CLIENT
WHERE UPPER(name) LIKE ‘J%’
OR upper(name) LIKE ‘%M%’
OR
Upper(name) LIKE ‘??E%’
20)Using a set operator, display the client number of all clients
who have never placed an order.
Answer:
SELECT clientno
FROM CLIENT
MINUS
SELECT clientno
FROM ORDER
21)Using a set operator, display the client number of all clients
who have ever placed an order and whose name does not contain
the string Sm.
SELECT clientno
FROM CLIENT
WHERE INSTR(name,’Sm’) = 0
INTERSECT
SELECT clientno
FROM
ORDER
23)Display the client name for all clients who have placed an
order where any order line has more than 3 items. Do not use a
table join anywhere in your query.
SELECT name
FROM CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND ol.no_of_items> 3
26)Display the earliest shipping date in the format:
DD/MON/YYYY
SELECT to_date(MIN(shipping_date),’DD/MON/YYYY’)
FROM ORDER_LINE
27)Display the order number and the number of months since
the order was shipped for all orders that have been shipped in
the last year (365 days). (Hint: Unshipped orders will have a
null value).
SELECT o.orderno,
MONTHS_BETWEEN(shipping_date,order_date)
FROM ORDER o,
ORDER_LINE ol
WHERE o.orderno = ol.orderno
AND shipping_date BETWEEN sysdate AND sysdate-365
29)Display the surname for all employees who earn less the
average salary of all those employees in the department with the
lowest average salary.
Answer:
SELECT lastname
FROM EMPLOYEE e
WHERE salary < (SELECT MIN(avg_salary) FROM (SELECT
AVG(salary) avg_salary, department
FROM EMPLOYEE
GROUP BY department))
30)Display the client number and the total number of orders the
client has placed for all clients who have placed at least one
order in 2011. (Hint: Use exists).
U did not done this query and my Professor needs it.
Distance-Vector Routing (graded)
When should distance-vector routing be used, and how do
distance-vector routing protocols work? Can you provide some
examples? How does distance vector complete its convergence
process?
Dynamic Routing (graded)
Discuss how dynamic routing occurs as compared to static
routing. What is a stub network, and when might these be used?
Lecture_07_S12014.ppt
Welcome to
CIS 2002: DATABASE DESIGN AND IMPLEMENTATION
Semester 1, 2014 – LECTURE 7
*
*
*
3.wmf
COMMONWEALTH OF AUSTRALIA
Copyright Regulations 1969
WARNING
This material has been copied and communicated to you
by or on behalf of The University of Southern
Queensland pursuant to Part VA of the
Copyright Act
1968 (
the Act
).
The material in thi
s communication may be subject to
copyright under the Act. Any further copying or
communication of this material by you may be the subject
of copyright protection under the Act.
Do not remove this notice.
USAGE OF SLIDES
Use of these lecture slides is restricted to teaching staff and
students enrolled in this course. All students who use these
slides should have acquired the prescribed texts.
These slides are for the personal use of students on the Study
Desk only.
Students should not copy slides, allow third parties access to
the slides or distribute the slides.
Copyright of these slides vests in the university and, where
applicable, Cengage Education or Pearson (publishers of the
textbooks)
*
*
READINGS – WEEK 9Study Book, Module 7
*
*
TERNARY RELATIONSHIPSWe have concentrated on
analysing the relationship between two entities so
farSometimes, three (or more) entities can be involved in a
relationship which require careful analysisTernary relationships
involve three entities.
*
*
TERNARY RELATIONSHIPSConsider the business rules:An
employee may have one or more skills and a skill may belong to
many employeesAn employee may work on one or more projects
and a project may require many employeesA project requires
one or many skills to complete and a skill may be required in
several projects.We need to store information about which skills
each employee uses on each project
*
*
TERNARY RELATIONSHIPS
*
*
EMPLOYEE
SKILL
PROJECT
EMPLOYEE(empid#,name,date started)
SKILL(skillid#,skill name)
PROJECT(projectid#,name,loc,budget)
TERNARY RELATIONSHIPSThe ring structure is called a
closed relationship which may indicate redundancy.
When this happens, we resolve the three M:M relationships with
a single intersecting entity in the middle tying in all the other
entities.
*
*
TERNARY RELATIONSHIPS
*
*
EMPLOYEE
SKILL
PROJECT
SKILL USAGE
EMPLOYEE(empid#,name, date started)
SKILL(skillid#,skill name)
PROJECT(projectid#,name, loc, budget)
SKILL USAGE(empid#, skillid#, projectid#)
SKILL USAGE stores information about each SKILL an
EMPLOYEE uses in each PROJECT.
QUATERNARY RELATIONSHIPS?Similar to ternary
relationship but four entities are linked via a single intersection
entity – rare indeed!
*
*
NORMALISATIONThe process of organising relational
database in order to minimise redundancy and dependencies.
Involves splitting larger relations (or tables) into smaller and
less redundant tables and defining relationships between
them.First Normal Form (1NF)Second Normal Form (2NF)Third
Normal Form (3NF)Boyce-Codd Normal Form (BCNF)Fourth
Normal Form (4NF)Fifth Normal Form (5NF), …..
A relational database is considered “normalised” when it is in
3NF!
*
*
REDUNDANCYRefers to unnecessary data storage or
duplication of storage
Best done before relations are derived
*
*
REDUNDANT ENTITIESSometimes system is poorly
understood, especially during early phases of analysisCases of
redundant entities:Different users may have different names for
the same entityTwo entities have so much in common that they
are really one
*
*
REDUNDANT ATTRIBUTESWhen unwanted attributes are
present in a relationOccurs most often when a sub-type is
required but not implemented
*
*
DERIVED VALUESOccurs when the value in a column can be
calculated using values from other columnsExample:“Age”
column will have derived values if there is already a column for
“date of birth”“total” column will have derived values if it is
multiplication of the values from “rate” column and “quantity”
column.We should avoid storing derived values However, we
store them in certain cases to solve performance problems or
when we wish to query the column frequently
*
*
REDUNDANT RELATIONSHIPSWhen unwanted relationships
are created between relationsMost common in closed
loopsExample: If we resolved a ternary relationship using three
intersection entities rather than one
*
*
The DATABASE DESIGN PROCESS
AN EMPLOYEE WORKS FOR ONE COMPANY AND IS
ASSIGNED TO ONE DEPARTMENT. A DEPARTMENT MAY
HAVE MANY EMPLOYEES.
For EMPLOYEE, we store EMPID, NAME,
SKILLTYPE,SKILLNAME and MULTIPLE ADRESSES, (e.g.
home, mailing).
For DEPARTMENT, we store DEPTID and NAME.
For COMPANY, we store COMPANYNAME.
*
*
STEP 1: DRAW DATA MODEL (ER DIAGRAM)
( I will not do this in detail here – YOU ARE ALL EXPERTS)
*
*
The DATABASE DESIGN PROCESS
STEP 2: DERIVE RELATIONS / ENTITY LIST
COMPANY(companyname#)
DEPARTMENT(deptid#,name)
EMPLOYEE(empid#,name,skilltype,skillname,
((address)),companyname#,deptid#)
*
*
The DATABASE DESIGN PROCESS
Step 3: Normalise relations.
This is our task to learn this week!
After the top-down modelling process, we perform a bottom-up
check on our work using Normalisation. Often, we find that
there are potential problems.
The most dangerous problems are called redundancy and
anomalies.
*
*
The DATABASE DESIGN PROCESS
Anomalies
Anomalies are irregularities in the database design.
Consider the following relation:
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming
50Consider:delete stud# 100
*
*
*
3
*
*
Anomalies
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming
50Consider:delete stud# 100 (loss of information about
“skiing”)
*
*
*
Anomalies
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming 50
Scuba Diving 150Consider:delete stud# 100 (loss of
information about skiing)insert “Scuba Diving” activity and its
corresponding fee as $150
CAN THIS BE DONE?
*
*
*
Anomalies
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming
50Consider:delete stud# 100 (loss of information about
skiing)insert “Scuba Diving” activity with $150 fee (can’t insert
until at least a student takes up scuba diving activity)
*
*
*
Anomalies
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming
60Consider:delete stud# 100 (loss of information about
skiing)insert “Scuba Diving” activity with $150 fee (can’t
insert until at least a student takes up scuba diving
activity)update swimming cost from $50 to $60
*
*
*
Anomalies
ACTIVITY(studno#, activity, fee)
100 Skiing 200
150 Swimming 50
175 Squash 50
200 Swimming
60Consider:delete stud# 100 (loss of information about
skiing)insert “Scuba Diving” activity with $150 fee (can’t
insert until at least a student takes up scuba diving
activity)update swimming cost from $50 to $60 – if it is only
updated for studno# 200 (inconsistent results since its not
updated for studno# 150)
*
Solution
The problem is that the ACTIVITY relation has information
about the activity and student together

More Related Content

Similar to SECTION D2)Display the item number and total cost for each order l.docx

Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05CHOOSE
 
in C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdfin C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdfadithyaups
 
Excel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment meExcel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment mejoney4
 
structenumtypedefunion.pptx
structenumtypedefunion.pptxstructenumtypedefunion.pptx
structenumtypedefunion.pptxKUPPALAPADMINI
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesSami Mut
 
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...Alpro
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2Warui Maina
 
Databaseconcepts
DatabaseconceptsDatabaseconcepts
Databaseconceptsdilipkkr
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesSami Mut
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial        HS2021 Database Design and UseWeek 2 - 2020 Tutorial
HS2021 Database Design and UseWeek 2 - 2020 Tutorialtroutmanboris
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docxShiraPrater50
 
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole Collegedezyneecole
 

Similar to SECTION D2)Display the item number and total cost for each order l.docx (20)

Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
in C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdfin C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdf
 
Excel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment meExcel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment me
 
structenumtypedefunion.pptx
structenumtypedefunion.pptxstructenumtypedefunion.pptx
structenumtypedefunion.pptx
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
 
Sharbani bhattacharya VB Structures
Sharbani bhattacharya VB StructuresSharbani bhattacharya VB Structures
Sharbani bhattacharya VB Structures
 
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...
Computer paper 3 may june 2004 9691 cambridge General Certificate of educatio...
 
Fahri tugas cloud1
Fahri tugas cloud1Fahri tugas cloud1
Fahri tugas cloud1
 
Bc0037
Bc0037Bc0037
Bc0037
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 
Databaseconcepts
DatabaseconceptsDatabaseconcepts
Databaseconcepts
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
 
03 structures
03 structures03 structures
03 structures
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial        HS2021 Database Design and UseWeek 2 - 2020 Tutorial
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
1 z1 051
1 z1 0511 z1 051
1 z1 051
 
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 Apurv Gupta, BCA ,Final year , Dezyne E'cole College Apurv Gupta, BCA ,Final year , Dezyne E'cole College
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
 

More from kenjordan97598

You are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docxYou are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docxkenjordan97598
 
You are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docxYou are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docxkenjordan97598
 
You are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docxYou are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docxkenjordan97598
 
You are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docxYou are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docxkenjordan97598
 
You are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docxYou are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docxkenjordan97598
 
You are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docxYou are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docxkenjordan97598
 
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docxYou are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docxkenjordan97598
 
You are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docxYou are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docxkenjordan97598
 
You are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docxYou are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docxkenjordan97598
 
You are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docxYou are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docxkenjordan97598
 
You are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docxYou are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docxkenjordan97598
 
You are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docxYou are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docxkenjordan97598
 
You are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docxYou are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docxkenjordan97598
 
You are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docxYou are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docxkenjordan97598
 
You are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docxYou are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docxkenjordan97598
 
You are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docxYou are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docxkenjordan97598
 
You are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docxYou are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docxkenjordan97598
 
You are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docxYou are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docxkenjordan97598
 
You are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docxYou are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docxkenjordan97598
 
You are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docxYou are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docxkenjordan97598
 

More from kenjordan97598 (20)

You are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docxYou are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docx
 
You are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docxYou are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docx
 
You are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docxYou are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docx
 
You are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docxYou are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docx
 
You are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docxYou are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docx
 
You are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docxYou are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docx
 
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docxYou are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
 
You are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docxYou are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docx
 
You are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docxYou are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docx
 
You are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docxYou are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docx
 
You are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docxYou are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docx
 
You are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docxYou are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docx
 
You are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docxYou are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docx
 
You are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docxYou are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docx
 
You are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docxYou are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docx
 
You are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docxYou are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docx
 
You are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docxYou are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docx
 
You are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docxYou are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docx
 
You are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docxYou are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docx
 
You are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docxYou are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docx
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Recently uploaded (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

SECTION D2)Display the item number and total cost for each order l.docx

  • 1. SECTION D 2)Display the item number and total cost for each order line (total cost = no of items X item cost). Name the calculated column TOTAL COST. Answer: SELECT item_number, no_of_items * item_cost “TOTAL COST” FROM ORDER_LINE 4)Display the order number and client number from the ORDER table. Output the result in the format. Client <clientno> ordered <orderno> Answer: SELECT ‘Client ‘+ clientno+’ordered ‘+ orderno AS result FROM ORDER 6)Display the client name and order date for all orders using the traditional method. Answer: SELECT name, order_date FROM CLIENT c INNER JOIN ORDER o ON (c.clientno = o.clientno); 7)Repeat query (7) but also display all clients who have never ordered anything. Answer: SELECT name, order_date FROM CLIENT c LEFT OUTER JOIN ORDER o ON (c.clientno = o.clientno); 8) Display the client name and order date for all orders using the natural join keywords. SELECT name, order_date
  • 2. FROM CLIENT NATURAL JOIN ORDER; 9) Display the client name and order date for all orders using the JOIN . . . USING method. SELECT name, order_date FROM CLIENT c JOIN ORDER o USING (clientno); 10) Display the client number, order date and shipping date for all orders where the shipping date is between three and six months after the order date. SELECT clientno, order_date, shipping_date FROM CLIENT c, ORDER o, ORDER_LINE ol WHERE c.clientno = o.clientno AND o.orderno = ol.orderno AND shipping_date BETWEEN ADD_MONTHS(shipping_date,3) AND ADD_MONTHS(shipping_date,6); 16) Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>. SELECT orderno, order_line_number, NVL(shipping_date,’<not shipped yet>’) FROM ORDER_LINE 18)Display the clientno and total value for all orders placed by that client. Output the result in the following format: Client <clientno> has placed orders to the value of <total value> SELECT ‘Client ‘+clientno+’ has placed order to the value of ‘+ SUM(no_of_items*item_cost)
  • 3. FROM ORDER_LINE GROUP BY clientno 19) Display all clients whose name begins with the letter J or contains the letter M anywhere or contains E as the third letter. SELECT * FROM CLIENT WHERE UPPER(name) LIKE ‘J%’ OR upper(name) LIKE ‘%M%’ OR Upper(name) LIKE ‘??E%’ 20)Using a set operator, display the client number of all clients who have never placed an order. Answer: SELECT clientno FROM CLIENT MINUS SELECT clientno FROM ORDER 21)Using a set operator, display the client number of all clients who have ever placed an order and whose name does not contain the string Sm. SELECT clientno FROM CLIENT WHERE INSTR(name,’Sm’) = 0 INTERSECT SELECT clientno FROM ORDER 23)Display the client name for all clients who have placed an
  • 4. order where any order line has more than 3 items. Do not use a table join anywhere in your query. SELECT name FROM CLIENT c, ORDER o, ORDER_LINE ol WHERE c.clientno = o.clientno AND o.orderno = ol.orderno AND ol.no_of_items> 3 26)Display the earliest shipping date in the format: DD/MON/YYYY SELECT to_date(MIN(shipping_date),’DD/MON/YYYY’) FROM ORDER_LINE 27)Display the order number and the number of months since the order was shipped for all orders that have been shipped in the last year (365 days). (Hint: Unshipped orders will have a null value). SELECT o.orderno, MONTHS_BETWEEN(shipping_date,order_date) FROM ORDER o, ORDER_LINE ol WHERE o.orderno = ol.orderno AND shipping_date BETWEEN sysdate AND sysdate-365 29)Display the surname for all employees who earn less the average salary of all those employees in the department with the lowest average salary. Answer: SELECT lastname FROM EMPLOYEE e WHERE salary < (SELECT MIN(avg_salary) FROM (SELECT AVG(salary) avg_salary, department FROM EMPLOYEE GROUP BY department))
  • 5. 30)Display the client number and the total number of orders the client has placed for all clients who have placed at least one order in 2011. (Hint: Use exists). U did not done this query and my Professor needs it. Distance-Vector Routing (graded) When should distance-vector routing be used, and how do distance-vector routing protocols work? Can you provide some examples? How does distance vector complete its convergence process? Dynamic Routing (graded) Discuss how dynamic routing occurs as compared to static routing. What is a stub network, and when might these be used? Lecture_07_S12014.ppt Welcome to CIS 2002: DATABASE DESIGN AND IMPLEMENTATION Semester 1, 2014 – LECTURE 7 *
  • 6. * * 3.wmf COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been copied and communicated to you by or on behalf of The University of Southern Queensland pursuant to Part VA of the Copyright Act 1968 ( the Act ). The material in thi s communication may be subject to copyright under the Act. Any further copying or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice.
  • 7. USAGE OF SLIDES Use of these lecture slides is restricted to teaching staff and students enrolled in this course. All students who use these slides should have acquired the prescribed texts. These slides are for the personal use of students on the Study Desk only. Students should not copy slides, allow third parties access to the slides or distribute the slides. Copyright of these slides vests in the university and, where applicable, Cengage Education or Pearson (publishers of the textbooks) * * READINGS – WEEK 9Study Book, Module 7 * * TERNARY RELATIONSHIPSWe have concentrated on analysing the relationship between two entities so farSometimes, three (or more) entities can be involved in a relationship which require careful analysisTernary relationships involve three entities. * *
  • 8. TERNARY RELATIONSHIPSConsider the business rules:An employee may have one or more skills and a skill may belong to many employeesAn employee may work on one or more projects and a project may require many employeesA project requires one or many skills to complete and a skill may be required in several projects.We need to store information about which skills each employee uses on each project * * TERNARY RELATIONSHIPS * * EMPLOYEE SKILL PROJECT EMPLOYEE(empid#,name,date started) SKILL(skillid#,skill name) PROJECT(projectid#,name,loc,budget) TERNARY RELATIONSHIPSThe ring structure is called a closed relationship which may indicate redundancy. When this happens, we resolve the three M:M relationships with a single intersecting entity in the middle tying in all the other entities. *
  • 9. * TERNARY RELATIONSHIPS * * EMPLOYEE SKILL PROJECT SKILL USAGE EMPLOYEE(empid#,name, date started) SKILL(skillid#,skill name) PROJECT(projectid#,name, loc, budget) SKILL USAGE(empid#, skillid#, projectid#) SKILL USAGE stores information about each SKILL an EMPLOYEE uses in each PROJECT. QUATERNARY RELATIONSHIPS?Similar to ternary relationship but four entities are linked via a single intersection entity – rare indeed! * * NORMALISATIONThe process of organising relational database in order to minimise redundancy and dependencies. Involves splitting larger relations (or tables) into smaller and less redundant tables and defining relationships between
  • 10. them.First Normal Form (1NF)Second Normal Form (2NF)Third Normal Form (3NF)Boyce-Codd Normal Form (BCNF)Fourth Normal Form (4NF)Fifth Normal Form (5NF), ….. A relational database is considered “normalised” when it is in 3NF! * * REDUNDANCYRefers to unnecessary data storage or duplication of storage Best done before relations are derived * * REDUNDANT ENTITIESSometimes system is poorly understood, especially during early phases of analysisCases of redundant entities:Different users may have different names for the same entityTwo entities have so much in common that they are really one * * REDUNDANT ATTRIBUTESWhen unwanted attributes are present in a relationOccurs most often when a sub-type is required but not implemented * *
  • 11. DERIVED VALUESOccurs when the value in a column can be calculated using values from other columnsExample:“Age” column will have derived values if there is already a column for “date of birth”“total” column will have derived values if it is multiplication of the values from “rate” column and “quantity” column.We should avoid storing derived values However, we store them in certain cases to solve performance problems or when we wish to query the column frequently * * REDUNDANT RELATIONSHIPSWhen unwanted relationships are created between relationsMost common in closed loopsExample: If we resolved a ternary relationship using three intersection entities rather than one * * The DATABASE DESIGN PROCESS AN EMPLOYEE WORKS FOR ONE COMPANY AND IS ASSIGNED TO ONE DEPARTMENT. A DEPARTMENT MAY HAVE MANY EMPLOYEES. For EMPLOYEE, we store EMPID, NAME, SKILLTYPE,SKILLNAME and MULTIPLE ADRESSES, (e.g. home, mailing). For DEPARTMENT, we store DEPTID and NAME. For COMPANY, we store COMPANYNAME. * *
  • 12. STEP 1: DRAW DATA MODEL (ER DIAGRAM) ( I will not do this in detail here – YOU ARE ALL EXPERTS) * * The DATABASE DESIGN PROCESS STEP 2: DERIVE RELATIONS / ENTITY LIST COMPANY(companyname#) DEPARTMENT(deptid#,name) EMPLOYEE(empid#,name,skilltype,skillname, ((address)),companyname#,deptid#) * * The DATABASE DESIGN PROCESS Step 3: Normalise relations. This is our task to learn this week! After the top-down modelling process, we perform a bottom-up check on our work using Normalisation. Often, we find that there are potential problems. The most dangerous problems are called redundancy and anomalies. * * The DATABASE DESIGN PROCESS
  • 13. Anomalies Anomalies are irregularities in the database design. Consider the following relation: ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50 175 Squash 50 200 Swimming 50Consider:delete stud# 100 * * * 3 * * Anomalies ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50 175 Squash 50 200 Swimming 50Consider:delete stud# 100 (loss of information about “skiing”)
  • 14. * * * Anomalies ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50 175 Squash 50 200 Swimming 50 Scuba Diving 150Consider:delete stud# 100 (loss of information about skiing)insert “Scuba Diving” activity and its corresponding fee as $150 CAN THIS BE DONE? * * * Anomalies ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50 175 Squash 50 200 Swimming 50Consider:delete stud# 100 (loss of information about
  • 15. skiing)insert “Scuba Diving” activity with $150 fee (can’t insert until at least a student takes up scuba diving activity) * * * Anomalies ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50 175 Squash 50 200 Swimming 60Consider:delete stud# 100 (loss of information about skiing)insert “Scuba Diving” activity with $150 fee (can’t insert until at least a student takes up scuba diving activity)update swimming cost from $50 to $60 * * * Anomalies ACTIVITY(studno#, activity, fee) 100 Skiing 200 150 Swimming 50
  • 16. 175 Squash 50 200 Swimming 60Consider:delete stud# 100 (loss of information about skiing)insert “Scuba Diving” activity with $150 fee (can’t insert until at least a student takes up scuba diving activity)update swimming cost from $50 to $60 – if it is only updated for studno# 200 (inconsistent results since its not updated for studno# 150) * Solution The problem is that the ACTIVITY relation has information about the activity and student together