Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment will cover the basics: CRUD Statements ( INSERT , SELECT, UPDATE, and DELETE ) Basic single table SELECTs, JOINS or multi - table

This assignment will cover the basics:
CRUD Statements (INSERT, SELECT, UPDATE, and DELETE)
Basic single table SELECTs,
JOINS or multi-table SELECTs,
Grouping or Aggregate Functions,
Sub-Queries, and
SET Operators
Submission
Each student will submit a single .sql file with appropriate commenting such that the entire file will run at once. That is, the header and question labelling should be commented out and the answers in SQL should NOT be commented out. You should copy the question into a comment block before each answer in the SQL file for future reference.
Tasks
1. Create an SQL statement that adds yourself to the Players table. Use your real first and last names, your real dob, and use your studentID as the regNumber. Make yourself active and use a playerID of your own choice.
2. Create an SQL statement that change your professors (whom is a player in the database) dob to be May 16,1992.
3. Create a statement that adds both yourself and your professor to the team called Noobs making yourself active and your professor not active. Choose a jersey number for yourself and use number 16 for your prof.
4. Create a query that outputs the team roster for all active teams in the league. Include the player names, jersey number, and team name in each row, making sure that players on the same team are together in the output, further sorted by last name, then by first name.
5. Create a query that outputs the league schedule (game number, date, both team names, and location name) for all future games, or games not yet played. Sort the output in ascending chronological order. Use JOIN and not sub-queries.
6. Repeat Question 5, but use sub-queries to obtain the team names, rather than JOINS. You may still use JOINS for other output if required. Note: you should obtain the exact same output in Q5 and Q6.
7. Take the statement from either Q5 or Q6 and store it in the database as a view, called vwFutureGames. Then create a query that uses the view to output the exact same results, including sorting.
8. Create a query that outputs the names of the soccer fields (locations) in the database that have never been assigned a game within the league. You may NOT use JOINS or Sub-Queries in the main statement, but you may use a sub-query to obtain the names afterwards.
9. Repeat Question 8 using JOINS and NOT set operators.
10. Create a query that outputs the number of games each team has played as the home team and how many games they have played as the away team as of today. You may assume that the isPlayed field is up to date. A sample of the output might look like this:
TEAMID TEAMNAME HOMEGAMES AWAYGAMES
1 kickers 56
2 wannabees 46
......

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

ISBN: 0805302441, 978-0805302448

More Books

Students also viewed these Databases questions