Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MelonDeployFinal1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
65160117
MelonDeployFinal1
Commits
44e7586a
Commit
44e7586a
authored
3 months ago
by
65160117
Browse files
Options
Downloads
Patches
Plain Diff
Delete database.sql
parent
344679e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
database.sql
+0
-66
0 additions, 66 deletions
database.sql
with
0 additions
and
66 deletions
database.sql
deleted
100644 → 0
+
0
−
66
View file @
344679e2
-- สร้างฐานข้อมูล
CREATE
DATABASE
IF
NOT
EXISTS
melon_cloud_db
;
USE
melon_cloud_db
;
-- สร้างตารางผู้ใช้
CREATE
TABLE
users
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
username
VARCHAR
(
50
)
NOT
NULL
UNIQUE
,
password
VARCHAR
(
255
)
NOT
NULL
,
email
VARCHAR
(
100
)
NOT
NULL
UNIQUE
,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
);
-- สร้างตารางหมวดหมู่
CREATE
TABLE
categories
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
name
VARCHAR
(
100
)
NOT
NULL
,
description
TEXT
,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
);
-- สร้างตารางผู้จัดจำหน่าย
CREATE
TABLE
suppliers
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
name
VARCHAR
(
100
)
NOT
NULL
,
contact_name
VARCHAR
(
100
),
phone
VARCHAR
(
20
),
email
VARCHAR
(
100
),
address
TEXT
,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
);
-- สร้างตารางสินค้า
CREATE
TABLE
products
(
id
INT
PRIMARY
KEY
AUTO_INCREMENT
,
name
VARCHAR
(
255
)
NOT
NULL
,
price
DECIMAL
(
10
,
2
)
NOT
NULL
,
stock
INT
NOT
NULL
DEFAULT
0
,
category_id
INT
,
supplier_id
INT
,
image_url
VARCHAR
(
255
)
DEFAULT
NULL
,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
FOREIGN
KEY
(
category_id
)
REFERENCES
categories
(
id
),
FOREIGN
KEY
(
supplier_id
)
REFERENCES
suppliers
(
id
)
);
-- เพิ่มข้อมูลตัวอย่างในตารางหมวดหมู่
INSERT
INTO
categories
(
name
,
description
)
VALUES
(
'อาหาร'
,
'อาหารและเครื่องปรุง'
),
(
'เครื่องดื่ม'
,
'เครื่องดื่มทุกประเภท'
),
(
'ขนม'
,
'ขนมและของหวาน'
);
-- เพิ่มข้อมูลตัวอย่างในตารางผู้จัดจำหน่าย
INSERT
INTO
suppliers
(
name
,
contact_name
,
phone
,
email
,
address
)
VALUES
(
'บริษัท อาหารดี จำกัด'
,
'คุณสมชาย'
,
'02-123-4567'
,
'somchai@fooddee.com'
,
'กรุงเทพฯ'
),
(
'ร้านเครื่องดื่มสดใหม่'
,
'คุณสมหญิง'
,
'02-234-5678'
,
'somying@drink.com'
,
'นนทบุรี'
),
(
'โรงงานขนมไทย'
,
'คุณมานี'
,
'02-345-6789'
,
'manee@thaidessert.com'
,
'สมุทรปราการ'
);
-- เพิ่มข้อมูลตัวอย่างในตารางสินค้า
INSERT
INTO
products
(
name
,
price
,
stock
,
category_id
,
supplier_id
)
VALUES
(
'ข้าวผัด'
,
50
.
00
,
100
,
1
,
1
),
(
'ผัดกะเพรา'
,
50
.
00
,
100
,
1
,
1
),
(
'น้ำส้ม'
,
20
.
00
,
200
,
2
,
2
),
(
'ชาเย็น'
,
25
.
00
,
200
,
2
,
2
),
(
'มันฝรั่งทอด'
,
30
.
00
,
150
,
3
,
3
),
(
'คุกกี้'
,
15
.
00
,
300
,
3
,
3
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment