forked from harsh432004/Complete-Data-Science-with-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay 16-1 Joins and accessing db.sql
48 lines (37 loc) · 1.07 KB
/
Day 16-1 Joins and accessing db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
CREATE DATABASE sports;
USE sports;
CREATE TABLE cricket (
player_id INT AUTO_INCREMENT,
player_name CHAR(100) NOT NULL,
player_role CHAR(100) NOT NULL,
country CHAR(100) NOT NULL,
PRIMARY KEY (player_id)
);
INSERT INTO cricket(player_name, player_role, country)
VALUES
("Virat Kohli", "Batsman", "India"),
("ABD", "Wicketkeeper Batsman", "SouthAfrica"),
("Pollard", "All Rounder", "WestIndies"),
("Starc", "Bowler", "Australia"),
("Kane", "Batsman", "NewZealand");
select * from cricket;
CREATE TABLE football(
player_id INT AUTO_INCREMENT,
player_name CHAR(100) NOT NULL,
player_role CHAR(100) NOT NULL,
country CHAR(100) NOT NULL,
PRIMARY KEY (player_id)
);
INSERT INTO football(player_name, player_role, country)
VALUES
("Cristiano Ronaldo", "Forward", "Portugal"),
("Lionel Messi", "Forward", "Argentina"),
("Neymar Jr.", "Forward", "Brazil"),
("Robert Lewandowski", "Forward", "Poland"),
("Mohamed Salah", "Forward", "Egypt");
select * from football;
select player_role
AS PR
from cricket
Where PR ="Batsman";
drop database sports;