-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.sql
More file actions
50 lines (40 loc) · 1.03 KB
/
users.sql
File metadata and controls
50 lines (40 loc) · 1.03 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use message_board;
drop table if exists users;
create table users(
id int unsigned primary key auto_increment,
username char(20) unique ,
password char(30) not null,
token char(30) not null unique,
birthday date,
phone_number int unsigned unique ,
email char(30),
create_datetime datetime
default current_timestamp not null
);
desc users;
ALTER TABLE users
Change user_name username char(20);
ALTER TABLE users
MODIFY COLUMN token char(30) not null unique;
delete from users where token = 'bbc';
insert into
users(user_name, password, token)
values(
'Jack',
'123456',
'safesedese');
select * from users;
PREPARE createUser
FROM 'insert into users(
user_name, password, token)
VALUE (?, ?, ?)';
# set three variables for prepared statement.
SET @a = 'AAAA';
SET @b = '132131';
SET @c = 'bbc';
EXECUTE createUser USING @a, @b, @c;
DEALLOCATE PREPARE createUser;
PREPARE testMultipleStatement1
FROM 'insert into users(
user_name, password, token)
VALUE (?, ?, ?)';