-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
executable file
·33 lines (27 loc) · 885 Bytes
/
db.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
/* Query to create database*/
create database `user`;
/* Query to create table */
create table `user` (
`email` varchar(200) PRIMARY KEY,
`name` varchar(200),
`password` varchar(200),
`photo_url` varchar(500)
);
/* Query to insert */
INSERT INTO `user`
(`email`,`name`,`password`,`photo_url`)
values
('user2@gmail' , 'name2' ,'12345' , ''),
('user3@gmail' , 'name3' ,'12345' , ''),
('user4@gmail' , 'name4' ,'12345' , '');
/* Query to fetch data from database */
SELECT * FROM `user` where password='*****';
/* Query to delete */
DELETE from `user` where `email` = 'user4@gmail';
/* Query to update data in a database */
UPDATE `user` set `photo_url`='path/to/file.jpg' where email = 'user2@gmail';
/*
Readings from MYSQL:
http://www.w3schools.com/sql/default.asp
http://www.cheat-sheets.org/sites/sql.su/
http://cse.unl.edu/~sscott/ShowFiles/SQL/CheatSheet/SQLCheatSheet.html