-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkshop Part 1.sql
More file actions
40 lines (26 loc) · 832 Bytes
/
Copy pathWorkshop Part 1.sql
File metadata and controls
40 lines (26 loc) · 832 Bytes
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
CREATE DATABASE employee_data;
USE employee_data;
CREATE TABLE employee (
employee_id INT NOT NULL -- Ensures that there is some character in this column
, employee_name VARCHAR(255)
, PRIMARY KEY (employee_id) -- The id column is the unique identifier for our table
);
SELECT * FROM employee;
INSERT INTO employee (employee_id, employee_name, employee_age) VALUES
(1, 'Sam Reich', 40)
, (2, 'Brennan Lee Mulligan', 36)
, (3, 'Mike Trapp', 38);
SELECT * FROM employee;
SELECT employee_name AS 'Name' FROM employee;
SELECT * FROM employee ORDER BY employee_name;
ALTER TABLE employee
ADD employee_age INT;
UPDATE employee
SET employee_age = 40
WHERE employee_id = 1;
UPDATE employee
SET employee_age = 36
WHERE employee_id = 2;
UPDATE employee
SET employee_age = 38
WHERE employee_id = 3;