Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Database of the VIDEO_STORE has 4 tables (see attached code) CREATE TABLE Team ( idTeam varchar2(5) primary key, NameTeam varchar2(30) unique); CREATE TABLE Member

The Database of the VIDEO_STORE has 4 tables (see attached code)

CREATE TABLE Team ( idTeam varchar2(5) primary key, NameTeam varchar2(30) unique);

CREATE TABLE Member ( idM Varchar2(5) primary key, FnameM varchar2(30), LnameM varchar2(30),

CityM varchar2(30), YearMembership int(4), CONSTRAINT fk0 FOREIGN KEY(idTeam) REFERENCES Team (idTeam));

CREATE TABLE Competition ( idComp varchar2(5) primary key, TitleComp varchar2(30) unique, CompFees number(5));

CREATE TABLE Participation ( idM varchar2(5), idComp varchar2(5),

Score number(3), CONSTRAINT pk1 PRIMARY KEY(idM, idComp), CONSTRAINT fk1 FOREIGN KEY(idM) REFERENCES Member (idM), CONSTRAINT fk2 FOREIGN KEY(idComp) REFERENCES Competition (idComp));

1) Draw the CDM corresponding to the above SQL code.

2) Answer the following questions in SQL: a/ Give all information about all members.

b/ Give idM of Members who became members in 2018. c/ Give number of members (how many members) stored in the database. d/ Give the idComp of the competitions in which member M1 participated.

e/ Give the idComp of the competitions in which member 'Ahmed Salim' participated.

f/ Give for each idM the number of Competitions in which he participated.

g/ Give for each idM the total score he got from all competitions in which he participated. Show only those who scored more than 1000.

h/ Give for each team, the number of members who live in Muscat.

i/ Give the idComp of the Competition which has the highest fee.

j/ Delete from the database all members who live in Sur. k/ As the government has imposed new taxes, we want to increase by 5% all CompFees.

l/ Give the list of teams which have no members

m/ Give all idM and their team names, including those who have no team.

n/ We frequently query the database for the details of a certain member by executing select * from members where IidM=5 for example. Suppose we have a huge number of Members in the database and thus we would like to improve the performance of this sql query. Write a SQL statement for that.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions

Question

Find y'. y= |x + X (x) (x) X 1 02x+ 2x 1 O 2x + 1/3 Ex 2x +

Answered: 1 week ago