Part a:
We have to select ProfId,CrsCode,Semester from the teaching table and StudId,Grade from transcript table.
So , SQL query to retrieve this information from the tables is as follows :
select ProfId,StudId,Teaching.CrsCode,Teaching.Semester,Grade from Teaching,Transcript where Teaching.CrsCode = Transcript.CrsCode;
Part b:
We have to create a view called ProfStud with attributes Prof and Stud using the two given table.
So, SQL query for creating this view will be : (assuming CrsCode act as Foreign Key between two tables).
create view ProfStud (Prof,Stud) as select ProfId,StudId from Teaching,Transcript where Teaching.CrsCode=Transcript.CrsCode;
If CrsCode is not the foreign key between two tables , simply remove the where clause.
i.e. now the SQL query will be :
create view ProfStud (Prof,Stud) as select ProfId,StudId from Teaching,Transcript;
[15] 15. We are given two tables Teaching and Transcript. Teaching table has attributes: ProfId: Integer,...
This is a database with two tables relating to students at a school. Each student has a unique ID. There is a backlog table that maintains a record of active backlogs for each student. Write a query my oracle sql to print the names of the students who have at least one active backlog. The names should be printed in ascending order.The results should be in the following format: NAME Note: There could be students with the same name but...
Assume that the takes relation has not yet been defined. Give an
SQL statement that adds the takes relation to the database.
Assume that:
•Id is an integer
•course_id is a string of up to10 characters.
•sec_id should be a non-negative integer.
•the semester is a one-character field, equal to either ‘F’ or
‘S’, and the
•year is an integer.
•grade can be null, but if not, it should be a letter in the
string ‘ABCDF’.
Your statement must ensure...
QUESTION 5 Suppose there are two tables: A and B. and we run command SELECT * from A LEFT JOIN B on A.orderid = B.orderid. What would be the code output? only the records from table A where tables A and B have the same orderid only the records from table B where tables A and B have the same orderid the complete set of records from table A, along with the matching records (depending on the availability) from table...
Problem 1-5 using the table below in the picture to be
answered in Microsoft SQL. Thanks
4. Write SQL queries to answer the following questions, a. How many students were enrolled in secoon 14 b. How many students were enrolled in ISM 3113 5. Write an SOL query to answer the following question Which students were not enrolled in any courses on Problems and Exercises 6 through 14 are based on Figure 7-15. The problem set continues from Chapter 6,...
A state-wide land tax assessment database has two tables: LandParcel that stores a set of land parcels, and ZoningTypes that stores a set of zoning codes and zoning types. The LandParcel table has 5 columns: ParcelNumb as text indicating each parcel's unique number defined by the State, Zoning as an integer number indicating the numerical code of a zoning type and each land parcel belongs to one zoning type, Owner First Name and Owner Last Name as text indicating the...
(MMU) has decided to consolidate the functionality of three small overlapping database systems, which support applications for 1) teaching (e.g. instructor assignment and evaluation), for 2) registration (e.g. online course status, waiting lists), and for 3) student records (e.g. transcript generation) The resulting new system will support the following enterprise description: Professors and GTAs are assigned to teach the sections of each class being offered in a semester. At the end of the semester, they get a "team rating" (professors...
Problems and Exercises 1 through 5 are based on the class schedule 3NF relations along with some sample data in Figure 7-16. For
Problems and Exercises 1 through 5, draw a Venn or ER diagram and
mark it to show the data you expect your query to use to produce the
results.Figure 7-16: Class scheduling relations (for Problems and Exercises 1-5Figure 7-17 Adult literacy program (for Problems and Exercises 6-14)1. Write SQL retrieval commands for each of the following
queries:a....
This is about database system. Thank you.
Question A1 You are given with three Oracle tables, namely, Program, Channel and Booking, as shown in Tables 1 to 3. PROGRAM_ID PROGRAM_NAME DURATION 2012022 Dragon Dance 2014063 Haunted House 2016005 CID 2017172 Kung Fu Master 2018322 Family Affair 2019006 Hong Kong Sites 2019113 2019 Singing Contest 25 58 45 28 68 120 75 Table 1: Program CHANNEL_NO CHANNEL_NAME TVR-1 Rediffusion Channel 1 TV-P Television Pearl Channel TV-G Television Gold Channel Table 2:...
The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...
You will develop an E-Commerce database used to maintain
customers, products and sales information. You are required to 1)
gather and analyze requirements 2) design logical structure of the
database 3) create stored procedures to develop the tables and
insert the data 4) write SQL statements for data extraction and
reporting.
Throughout the course of this semester you have analyzed the
requirements for an eCommerce database, designed and developed your
database. As a class we have gone through the process...