-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSQL03-Update-Delete
More file actions
45 lines (29 loc) · 803 Bytes
/
Copy pathSQL03-Update-Delete
File metadata and controls
45 lines (29 loc) · 803 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
37
38
39
40
41
42
43
44
45
/* UPDATE AND DELETE */
/* Show databases */
SHOW DATABASES;
/* Use exercise database */
USE livraria;
/* Explore livraria table's */
SHOW TABLES;
DESC livros;
SELECT *
FROM livros;
/* update information */
UPDATE livros
SET statePublisher = 'SP'
WHERE bookAuthor = 'Eduardo Santos'
UPDATE livros
SET namePublisher = 'Atlas'
WHERE bookAuthor IN ('Geraldo Francisco', 'Leda Silva');
/* insert information */
INSERT INTO livros (bookName, bookAuthor)
VALUES
('The name of the wind', 'Patrick Rothfuss'),
('The lord of the rings', 'J. R. R. Tolkien');
/* delete information */
DELETE FROM livros
WHERE bookName LIKE '%The%';
-- OPERATOR % --
--operator %name -> anything(name) after %;
-- operator name% -> anything(name) before %;
-- operator %name% -> anything(name) between %;