Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!

SQL Queries For Beginners PDF 下载


分享到:
时间:2021-04-20 09:45来源:http://www.java1234.com 作者:转载  侵权举报
SQL Queries For Beginners PDF 下载
失效链接处理
SQL Queries For Beginners PDF 下载


本站整理下载:
提取码:9wbz 
 
 
相关截图:
 
主要内容:


Before we start we will first create a table and insert some sample data into it so we can use these 
tables in our select class. I want to explain the table design with actual data since that will help 
the reader to understand this in detail.
In database design the important phase is to create a table with proper normalization with 
primary and foreign key relationships.
Now in this example we will assume we need to create a restaurant Order Management tables 
with relationships.
For this we need an Order Master, an Order Detail and an Item Master as the major tables. We 
will use these 3 tables in this article. First let's start by creating the tables. As I have said, we will 
use the 3 tables here in this article so we start by creating the Item Master as the first table. As 
the name suggests this table will be used to store the items.
Create Table
Item Master: Here we have created an ItemMaster with the necessary fields. As I already said, 
we need to make a plan about our project. List all the necessary tables we need to create for the 
project and describe and list all the fields to be created for each table. Here I used Item_Code as 
a primary key field that will be used in another table for the reference to this main table.
1. CREATE TABLE [dbo].[ItemMasters]( 
2. [Item_Code] [varchar](20) NOT NULL, 
3. [Item_Name] [varchar](100) NOT NULL, 
4. [Price] Int NOT NULL, 
5. [TAX1] Int NOT NULL, 
6. [Discount] Int NOT NULL, 
7. [Description] [varchar](200) NOT NULL, 
8. [IN_DATE] [datetime] NOT NULL, 
9. [IN_USR_ID] [varchar](20) NOT NULL, 
10. [UP_DATE] [datetime] NOT NULL, 
11. [UP_USR_ID] [varchar](20) NOT NULL, 
12. CONSTRAINT [PK_ItemMasters] PRIMARY KEY CLUSTERED 
13. ( 
14. [Item_Code] ASC 
15. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW
_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
16. ) ON [PRIMARY]

 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐