Question
Q1. Create table team with the following fields and constraints. [2 marks] Field Data type Length Constraints team_ID number 10 Primary key teamName varchar 20
Q1. Create table team with the following fields and constraints. [2 marks]
Field | Data type | Length | Constraints |
team_ID | number | 10 | Primary key |
teamName | varchar | 20 | Not null |
city | varchar | 25 | --- |
Q2. Create table player with the following fields and constraints. [2 marks]
Field | Data type | Length | Constraints |
player_ID | number | 10 | Primary key |
playerName | varchar | 20 | Not null |
age | number | 3 | Check (age >20) |
salary | number | 10 | Default 5000 |
team_ID | number | 10 | Foreign key from team table teamid column |
Q3. Insert the following values in the team table. (Use Insert Command) [1 mark]
team_ID | teamName | city |
1001 | Alhilal | Riyadh |
1002 | Ittihad | Jeddah |
1003 | Hittin | Jazan |
1004 | Alwahda | Makka |
1005 | Alnasser | Riyadh |
Q4. Insert the following values in the player table. (Use Insert Command) [1 mark]
player_ID | playerName | age | salary | team_ID |
111 | Yunus | 25 | 3000 | 1001 |
222 | Mohammed | 21 | 7000 | 1002 |
333 | Ala | 30 | 10000 | 1004 |
Q5. Answer the following queries and write in the space provided. [4 marks]
Update the City of the Team 1003 to Samtah
Select team_ID, teamName of all teams who live in Riyadh
Alter column name city to be country
Select all the Players whose Salary is greater than 3000 and Age is lower than 30
Delete a player whose player_ID is 111
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started