Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THESE ARE ALL UNDER ONE PROBLEM This database schema is for a NBA basketball tournament and there are 4 relations in this schema, which are

THESE ARE ALL UNDER ONE PROBLEM

This database schema is for a NBA basketball tournament and there are 4 relations in this schema, which are described below along with their integrity constraints. Columns in the primary key are underlined.

Player (playerID: integer, name, varchar(50), position: varchar(10), height : integer, weight : integer, team: varchar(30)). Each player is assigned a unique playerID. The position of a player can either be Guard, Center, or Forward. The height of a player is in inches while the weight is in pounds. Each player plays for only one team. The team field is a foreign key to Team.

Team: (name, varchar(30, city ; varchar(20))

Each team has a unique name associated with it. There can be multiple teams from the same city.

Game: (gameID: integer, homeTeam: varchar(30), awayTeam : varchar(30), homeScore : integer, awayScore, integer, Date)

Each game has a unique gameID. The fields homeTeam and awayTeam are foreign keys to Team. Two teams may play each other multiple times each season. We assume that homeTeam and awayTeam are different.

GameStats (playerID: integer, gameID: integer, points: integer, assists : integer, rebounds : integer) GameStats records the performance statistics of a player within a game. A player may not play in every game, in which case there will be no statistics of a player within a game. gameID is a foreign key to Game. playerID is a foreign key to Player.

Express the following queries in 1) Algebra (1 to 4), II) Calculus (2 and 4) and 3) SQL(ALL)

1. List the games played by Lebron James.

2. List the names of the Lakers players involved in at least 1 game against the Bulls.

3. List the names of the Lakers players who played only when the team is away.

4. Which of the players of the Lakers played all the games of the team?

5. List for every player along with his team, the number of games he played.

6. What was the last time the Lakers played the Bulls (Note that you are being asked to write a query that returns the answer)

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

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

Which statement does not apply to the lock and key theory

Answered: 1 week ago

Question

Discuss communication challenges in a global environment.

Answered: 1 week ago