-
Notifications
You must be signed in to change notification settings - Fork 5
/
sample_db_script.sql
81 lines (59 loc) · 2.44 KB
/
sample_db_script.sql
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
CREATE DATABASE IF NOT EXISTS test;
USE test;
DROP TABLE IF EXISTS test.app_user;
CREATE TABLE test.app_user (
id int(11) NOT NULL AUTO_INCREMENT,
uname char(20) NOT NULL,
pword char(20) NOT NULL,
manager_level int(11) NOT NULL DEFAULT '0',
active int(11) NOT NULL DEFAULT '1',
session char(32) NOT NULL DEFAULT '',
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=87 DEFAULT CHARSET=utf8;
/*!40000 ALTER TABLE app_user DISABLE KEYS */;
LOCK TABLES app_user WRITE;
INSERT INTO test.app_user VALUES (37,'sally','somePass',0,1,''),
(38,'dude','dudepass',0,1,'');
UNLOCK TABLES;
/*!40000 ALTER TABLE app_user ENABLE KEYS */;
DROP TABLE IF EXISTS test.phone_number;
CREATE TABLE test.phone_number (
id int(11) NOT NULL AUTO_INCREMENT,
phone varchar(20) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40000 ALTER TABLE phone_number DISABLE KEYS */;
LOCK TABLES phone_number WRITE;
INSERT INTO test.phone_number VALUES (1,'(120)345-6789'),
(2,'(208)321-4567'),
(3,'(201)456-0987');
UNLOCK TABLES;
/*!40000 ALTER TABLE phone_number ENABLE KEYS */;
DROP TABLE IF EXISTS test.user_number;
CREATE TABLE test.user_number (
user_id int(11) NOT NULL,
phone_id int(11) NOT NULL,
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
/*!40000 ALTER TABLE user_number DISABLE KEYS */;
LOCK TABLES user_number WRITE;
INSERT INTO test.user_number VALUES (37,1,1),
(38,3,7),
(38,2,8);
UNLOCK TABLES;
/*!40000 ALTER TABLE user_number ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;