-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.query.sql
More file actions
39 lines (25 loc) · 1.04 KB
/
setup.query.sql
File metadata and controls
39 lines (25 loc) · 1.04 KB
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 setup;
USE setup;
CREATE TABLE IF NOT EXISTS setup.users (
id INT NOT NULL auto_increment,
first_name VARCHAR(100),
last_name VARCHAR(100),
handle VARCHAR(100),
age INT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
INSERT INTO `users`(`id`, `first_name`, `last_name`, `handle`, `age`)
VALUES (NULL,"francriso","mella","rrhh",43);
INSERT INTO `users`(`id`, `first_name`, `last_name`, `handle`, `age`)
VALUES (NULL,"raul","cardoza","rrhh",33);
INSERT INTO `users`(`id`, `first_name`, `last_name`, `handle`, `age`)
VALUES (NULL,"Jonathan","Smith","socio",37);
INSERT INTO `users`(`id`, `first_name`, `last_name`, `handle`, `age`)
VALUES (NULL,"francisco","fuentes","comercial",38);
SELECT * FROM users where age >= 35;
DELETE FROM `users` WHERE YEAR(created_at) > "2010";
SELECT * FROM users;
UPDATE `users` SET `first_name`="Coding",`last_name`="Dojo",`handle`="boss",`age`=7 WHERE id=3;
SELECT * FROM users;