Skip to content

Commit 3b38cc8

Browse files
committed
completed till Database Organization
1 parent f81a6b0 commit 3b38cc8

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/************************ 5) Template Databases ****************/
2+
/*
3+
In General, there are 2 templates; Template0 and Template1.
4+
Template0 is kinda like safty net and used it to create Template1.
5+
You don't want to mess up with Template0.
6+
*/
7+
8+
/******** Create Own Templates **********/
9+
CREATE DATABASE mysuperdupertemplate;
10+
--connect to that db and run
11+
CREATE TABLE superdupertable();
12+
--after creating the database and connect to it, you will see that table.
13+
CREATE DATABASE mysuperduperdatabase WITH mysuperdupertemplate;
14+
15+
16+
/*--------------------------------------------------------------------------------------------------------------*/
17+
18+
/*********** 6) Creating a Database **************/
19+
/*
20+
TEMPLATE : template01
21+
ENCODING : UTF8
22+
CONNECTION_LIMIT : 100
23+
OWNER : Current User
24+
*/
25+
CREATE DATABASE db_name
26+
[[WITH] [OWNER [=] user_name]
27+
[TEMPLATE [=] template]
28+
[ENCODING [=] encoding]
29+
[LC_COLLATE [=] lc_collate]
30+
[LC_CTYPE [=] lc_ctype]
31+
[TABLESPACE [=] tablespace]
32+
[CONNECTION LIMIT [=] connlimit]]
33+
34+
35+
-- to store ZTM db to store courses
36+
CREATE DATABASE ZTM;
37+
38+
-- Create Schema
39+
CREATE SCHEMA Sales;
40+
41+

0 commit comments

Comments
 (0)