Skip to content

Instantly share code, notes, and snippets.

@fmnobar
Created September 27, 2022 21:47
Show Gist options
  • Save fmnobar/f8e6bdb5cf3541546429443c31514cd7 to your computer and use it in GitHub Desktop.
Save fmnobar/f8e6bdb5cf3541546429443c31514cd7 to your computer and use it in GitHub Desktop.
SQL
DROP TABLE IF EXISTS salary;
CREATE TEMPORARY TABLE salary (city VARCHAR(30), average_salary int);
INSERT INTO
salary
VALUES
('san_francisco', '54500'),
('seattle', '54100'),
('new_york', '34400'),
('phoenix', '31800');
DROP TABLE IF EXISTS people;
CREATE TEMPORARY TABLE people (
person_id int,
name VARCHAR(30),
gender VARCHAR(30),
location VARCHAR(30),
birth_year int,
birth_month VARCHAR(30),
birth_day int,
job_title VARCHAR(30),
salary int
);
INSERT INTO
people
VALUES
(
'1',
'james',
'male',
'seattle',
'1984',
'9',
'15',
'software_developer',
'115000'
),
(
'2',
'mary',
'female',
'new_york',
'1992',
'1',
'13',
'financial_analyst',
'183000'
),
(
'3',
'john',
'male',
'san_francisco',
'1971',
'4',
'22',
'data_scientist',
'165000'
),
(
'4',
'patricia',
'female',
'phoenix',
'1971',
'8',
'15',
'physician',
'215000'
),
(
'5',
'michael',
'male',
'new_york',
'1966',
'1',
'13',
'retired',
'25000'
),
(
'6',
'jennifer',
'female',
'phoenix',
'1994',
'12',
'12',
'data_scientist',
'165000'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment