-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.sql
More file actions
41 lines (28 loc) · 1.04 KB
/
db.sql
File metadata and controls
41 lines (28 loc) · 1.04 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
----------------DATABASES CMD---------------------
SHOW DATABASES;
-- show databases ( show sql keyword can be caps or lower case but standard is caps)
--! CREATE DATABASE <name>;
-- Can create a db in the db server
CREATE DATABASE soap_store;
-- (Valid DB name)
CREATE DATABASE DogApp;
-- (Naming Convention show up lower_case So, Invalid DB name)
CREATE DATABASE hello_world_db;
--! DROP DATABASE <name>;
-- Can delete an exisiting db in the db server
DROP DATABASE hello_world_db;
-- *If db doesnot exit and still we try to delete the db, we get error :-
-- "Can't drop database 'hello_world_db'; database doesn't exist"
-- ! USE <db_name>
-- Tells db server, which db the user wants to work with
USE sys;
-- To know which db we are currently using
-- ! SELECT database();
--**************************************
-- Exerices :
CREATE DATABASE hello_world;
USE hello_world;
DROP DATABASE hello_world;
-- Now what will happend when we execute SELECT database(); ?
-- Ans : NULL (bcoz - we are not using any db)
--**************************************