-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.sql
More file actions
42 lines (33 loc) · 684 Bytes
/
string.sql
File metadata and controls
42 lines (33 loc) · 684 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
---------------!STRING Datatype-------------
CREATE DATABASE datatype_db;
USE datatype_db;
CREATE TABLE dogs
(
name CHAR(5),
breed VARCHAR(10)
);
INSERT INTO dogs
(name, breed)
VALUES
('bob', 'beagle');
INSERT INTO dogs
(name, breed)
VALUES
('robby', 'corgi');
INSERT INTO dogs
(name, breed)
VALUES
('princess jane', 'Retriever');
-- For above insert we get WARNING (this is bcoz- 'princess jane' exceeds the no of characters specified in the char )
SELECT *
FROM dogs;
-- !output-
/*
+-------+-----------+
| name | breed |
+-------+-----------+
| bob | beagle |
| robby | corgi |
| princ | Retriever |
+-------+-----------+
*/