![]() ) Code language: SQL (Structured Query Language) ( sql ) Table sales.order_items Order status: 1 = Pending 2 = Processing 3 = Rejected 4 = Completed Order_id INT IDENTITY ( 1, 1) PRIMARY KEY, A sales order has one or many line items stored in the sales.order_items table. It also stores the information on where the sales transaction was created (store) and who created it (staff).Įach sales order has a row in the sales_orders table. The sales.orders table stores the sales order’s header information including customer, order status, order date, required date, shipped date. ) Code language: SQL (Structured Query Language) ( sql ) Table sales.orders CREATE TABLE sales.customers (Ĭustomer_id INT IDENTITY ( 1, 1) PRIMARY KEY, The sales.customers table stores customer’s information including first name, last name, phone, email, street, city, state and zip code. ) Code language: SQL (Structured Query Language) ( sql ) Table sales.customers REFERENCES production.categories (category_id) Product_id INT IDENTITY ( 1, 1) PRIMARY KEY, Also, each category may have zero or many products. Hence, a brand may have zero or many products.Įach product also belongs a category specified by the category_id column. The production.products table stores the product’s information such as name, brand, category, model year, and list price.Įach product belongs to a brand specified by the brand_id column. ) Code language: SQL (Structured Query Language) ( sql ) Table production.products CREATE TABLE production.brands (īrand_id INT IDENTITY ( 1, 1) PRIMARY KEY, The production.brands table stores the brand’s information of bikes, for example, Electra, Haro, and Heller. ) Code language: SQL (Structured Query Language) ( sql ) Table production.brands CREATE TABLE production.categories (Ĭategory_id INT IDENTITY ( 1, 1) PRIMARY KEY, The production.categories table stores the bike’s categories such as children bicycles, comfort bicycles, and electric bikes. ) Code language: SQL (Structured Query Language) ( sql ) Table production.categories ![]() Staff_id INT IDENTITY ( 1, 1) PRIMARY KEY, If a staff no longer works for any stores, the value in the active column is set to zero. If the value in the manager_id is null, then the staff is the top manager. A store can have one or more staffs.Ī staff reports to a store manager specified by the value in the manager_id column. It also contains the communication information such as email and phone.Ī staff works at a store specified by the value in the store_id column. The sales.staffs table stores the essential information of staffs including first name, last name. ) Code language: SQL (Structured Query Language) ( sql ) Table sales.staffs Store_id INT IDENTITY ( 1, 1) PRIMARY KEY, Each store has a store name, contact information such as phone and email, and an address including street, city, state, and zip code. ![]() The sales.stores table includes the store’s information. The following illustrates the BikeStores database diagram:Īs you can see from the diagram, the BikeStores sample database has two schemas sales and production, and these schemas have nine tables. Summary: in this tutorial, you’ll learn about the SQL Server sample database called BikeStores.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |