Question

1. Shown below is the relational database schema for a database which contains details regarding bus journeys from Tronoh to
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

1:

SELECT B.opName, B.opCode, J.price
FROM BusOperator B, Journey J
WHERE J.price>RM50.00;

2:

SELECT opcode
FROM BusOperator
WHERE opName='Plusliner';

SELECT price
FROM Journey
WHERE opName='<#obtained opcode#>';

b) Structure of the above DB:

CREATE TABLE BusOperator
(
opCode int,
opName varchar(255),

PRIMARY KEY(opCode)
);

CREATE TABLE Journey
(
opCode int,
destinationCode int,
price int,

FOREIGN KEY (opCode) REFERENCES BusOperator(opCode)

FOREIGN KEY (destinationCode) REFERENCES Destination(destinationCode)
);

CREATE TABLE Destination
(
destinationCode int,
destinationName varchar(255),
distance int,

PRIMARY KEY(destinationCode)
);

c)

UPDATE destination

SET distance = (distance/0.62137);

we are using the direction conversion formaula i.e, km= mi/0.62137

Add a comment
Know the answer?
Add Answer to:
1. Shown below is the relational database schema for a database which contains details regarding bus...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The relational schema shown below is part of a student database. The primary and foreign keys are highlighted in bold.

    The relational schema shown below is part of a student database. The primary and foreign keys are highlighted in bold.Student (studNo, studName, address, mobileNo)Course (courseNo, courseName, creditHour, level) Registration (studNo, courseNo, regDate, semester, session)Project (projNo, projName, courseNo)Assignment (projNo, studNo, startDate, dueDate, hoursSpent)Write SQL queries based on the student database given above: 1. Create tables & constraints for the student database.2. Insert some data into the tables to check that the tables created are correct. No limit on how many rows you want...

  • 3. (20 POINTS) Consider the LIBRARY relational database schema below to write down the relational algebra...

    3. (20 POINTS) Consider the LIBRARY relational database schema below to write down the relational algebra expressions for the following two queries. No SQL statements are required. BOOK Bookid Title Publisher name BOOK AUTHORS Book id Author name PUBLISHER Name Address Phone BOOK COPIES Book d Branch Id No o copies BOOK LOANS Book Branch Id Card no Date out Due date LIBRARY BRANCH Branch Branch name Address BORROWER Card Name Address Phone 3.A.) (10 POINTS) Let the number of...

  • Consider the relational database schema for a company below. EMPLOYEE/NAME, SSN, BDATE, ADDRESS, SEX, SALARY, SUPERSSN,...

    Consider the relational database schema for a company below. EMPLOYEE/NAME, SSN, BDATE, ADDRESS, SEX, SALARY, SUPERSSN, DNA) TA DEPARTMENT(DNAME, DNUMBER. MESSINS, MGRSTARTDATE) DEPT_LOCATIONS(DNUMBER. DLOCATION PROJECT(PNAME, PNUMBER. PLOCATION, DNLIM) WORKS_ONCESSN.PNG, HOURS) DEPENDENTESSN, DEPENDENT-NAME, SEX, BDATE, RELATIONSHIP) Write SQL statements for the following queries: a) List the names of those employees who work in the "Production" department (6 marks). b) Find the maximum salary, minimum salary, and the average salary among employees who work for the "Production department (6 marks). Count the...

  • HELP DATABASE QU Question 1: Think About the relational database table data as given below, write...

    HELP DATABASE QU Question 1: Think About the relational database table data as given below, write the following queries in Oracle SQL. Company (Cid, Cname, City, Budget, Branch) Department (Deptno, Dname, Building, Cname) Employee (Ename, Deptno, Street, City, Phone, Salary) Works (Ename, Deptno, Hire_date) Location (Cname, Location ) 1. Write Query to Create the Company table, suggest appropriate data type of each attribute, consider that there should be a name for each company. 2. Find employee name/names who live in...

  • Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orde...

    Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orders(orderld, customerld, dateOrdered, dateRequired, status) Customer(customerld, customerLastName, customerStreet, customerCity, customerState, customer Lip OrderDetails(orderld.productld, quantity, lineNumber, amount) Products(productld, name, description, quantity, unitPrice) Account(accountNumber, customerld, dateOpened, creditCard, mailingStreet, mailingCity, mailingState, mailingZip) 2.1 (2 Points) List all possible foreign keys. For each foreign key list both the referencing and referenced relations. 2.2 (2 Points) Devise a reasonable database instance by filling the tables with data of...

  • CHAPTER 1: DATABASES AND DATABASE USERS Given the simple Doctor-Treats_Patient database schema which contains three files...

    CHAPTER 1: DATABASES AND DATABASE USERS Given the simple Doctor-Treats_Patient database schema which contains three files describing information about doctors and patients they treat as follows, answer the following questions with regards to this database.                                                                                                                                                                                 (Total for que 1 is 10 marks) Doctor (DocID: string, DName: string, DAddress: string, Numpatients: integer) Treats (DocId: string, SSN: string, illness: string, day: string, cost: real) Patient (SSN: string, PatientName: string, PAddress: string, Age:integer) Note : DocID, DName, DAddress and Numpatients...

  • Consider the SOCIAL NETWORK relational database schema description provided below which is used to manage a...

    Consider the SOCIAL NETWORK relational database schema description provided below which is used to manage a social network, where: - Persons are the users - They can have friends (a friend relation is symmetric meaning that if person1 is friend of person2, the person2 is automatically friend of person1) - They can post multiple posts on his wall or in other friend’s wall - They can like posts with different types of likes: like, love, fun, wow, sad or angry....

  • Question 2: SQL-5 marks Using the GAMEMEMBERS relational schema below a) List the order in which the tables were created? b) Write the CREATE TABLE statement for MEMBER table. Use appropriate dat...

    Question 2: SQL-5 marks Using the GAMEMEMBERS relational schema below a) List the order in which the tables were created? b) Write the CREATE TABLE statement for MEMBER table. Use appropriate data types and size. HINT please look at the sample data in part c LEVEL GAME Levelp Level GAMEName GAMEMEMBER GAMEMemberiD MemberiD GAMEID Leyelp Date MEMBER MemberiD FName LName Address Suburb State PostCode Phone RegionlD REGION RegionName RegionID c) Write a SQL statement that will insert the following data...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • I need help with this please, I'm very confused. Given the following relational model database schema:...

    I need help with this please, I'm very confused. Given the following relational model database schema: GUEST (email, address, phone_no, name) (phone_no) is a candidate key. Email and address are long strings, phone_no and name are also strings. TYPE (code, description) The type code is a numeric code and the description a length varying string. AMENITY (code, description) The amenity code is a numeric code and the description a length varying string. CITY (city_id, name, state, country) The city identification...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT