/* Week 4 Assignment */
/* Staff Table */
CREATE TABLE staff
( Staff_ID CHAR VARYING(6)
, Gender CHAR VARYING(3)
, Firstname CHAR VARYING(20)
, Lastname CHAR VARYING(30)
, Date_of_Birth DATE
, Social_Security CHAR VARYING(11)
, Other_Staff CHAR VARYING(50));
/* Retail Purchases Table */
CREATE TABLE retail_purchases
( Purchase_ID CHAR VARYING(9)
, Channel_Code CHAR VARYING(9)
, Customer_ID CHAR VARYING(6)
, Payment_ID CHAR VARYING(10)
, Promotion_ID CHAR VARYING(5)
, Store_ID CHAR VARYING(4)
, Staff_ID CHAR VARYING(6)
, Date_Time_Purchase CHAR VARYING(20)
, Amount CHAR VARYING(10)
, Other_Retailpurch CHAR VARYING(50));
/* Stores Table */
CREATE TABLE stores
( Store_ID CHAR VARYING(4)
, Warehouse_ID CHAR VARYING(5)
, Store_Details CHAR VARYING(50));
/* Warehouse Table */
CREATE TABLE warehouse
( Warehouse_ID CHAR VARYING(5)
, Warehouse_Details CHAR VARYING(50));
/* Products in Purchase Table */
CREATE TABLE products_purchased
( Purchase_ID CHAR VARYING(9)
, Product_ID CHAR VARYING(12)
, Quantity_Products_Purchased CHAR VARYING(100));
/* Products Table */
CREATE TABLE products
( Product_ID CHAR VARYING(12)
, Product_Detail CHAR VARYING(50));
/* Ref Channels Table */
CREATE TABLE ref_channels
( Channel_Code CHAR VARYING(9)
, Channel_Desc CHAR VARYING(30)
, In_Store CHAR VARYING(3));
/* Promotion Table */
CREATE TABLE promotion
( Promotion_ID CHAR VARYING(5)
, Date_To DATE
, Date_From DATE
, Promotion_Name CHAR VARYING(20)
, Promotion_Desc CHAR VARYING(30)
, Other_Promotion CHAR VARYING(50));
/* Customer Table */
CREATE TABLE customer
( Customer_ID CHAR VARYING(6)
, Customer_Details CHAR VARYING(50));
/* Payment Table */
CREATE TABLE payment
( Payment_ID CHAR VARYING(10)
, Payment_Method_Code CHAR VARYING(9)
, Date_Time_Payment CHAR VARYING(20)
, Other_Payment CHAR VARYING(50));
/* Ref Payment Method Table */
CREATE TABLE ref_payment_method
( Payment_Method_Code CHAR VARYING(4)
, Payment_Method_Desc CHAR VARYING(10));
/* Alter table staff */
ALTER TABLE staff
add Mobile_Number CHAR(9);
/* Insert Values to Tables */
INSERT INTO staff
VALUES ('123456', 'F', 'Leighanne', 'Bartlett', '1998-07-13', '123-45-6789', '816-039-3452', 'N/A');
INSERT INTO staff
VALUES ('123654', 'M', 'Gabe', 'Valdez', '1984-07-28', '321-54-9876', '816-134-7654', 'gabe_valdez@gmail.com');
INSERT INTO staff
VALUES ('987654', 'F', 'Bayleigh', 'Beal', '1999-01-02', '982-10-1234', '816-123-4534', 'N/A');
INSERT INTO retail_purchases
VALUES ('123456789', '987654321', '534687', '100', '32145', '4321', '123654', '2019-04-20,11:50am', '100', 'N/A');
INSERT INTO stores
VALUES ('4321', '54123', 'N/A');
INSERT INTO warehouse
VALUES ('54123', 'Quick Service');
INSERT INTO products_purchased
VALUES ('123456789', '132458670921', '2');
INSERT INTO products
VALUES ('132458670921', 'Brand New');
INSERT INTO ref_channels
VALUES('987654321', 'Direct', 'Yes');
INSERT INTO promotion
VALUES ('32145', '2019-05-01', '2019-04-01', 'Buy One, Get One', 'N/A', 'N/A');
INSERT INTO customer
VALUES ('534687', 'Regular');
INSERT INTO payment
VALUES ('100', 'CASH', '2019-04-20,11:50am', 'Done');
INSERT INTO ref_payment_method
VALUES ('CASH', 'Done');
/* SELECT ROW Statement */
SELECT * FROM staff;
SELECT * FROM retail_purchases;
SELECT * FROM stores;
SELECT * FROM warehouse;
SELECT * FROM products_purchased;
SELECT * FROM products;
SELECT * FROM ref_channels;
SELECT * FROM promotion;
SELECT * FROM customer;
SELECT * FROM payment;
SELECT * FROM ref_payment_method;
About Online Sqlite Compiler
Try our Online Sqlite Compiler (Version SQLite v3.20.1) to Edit, Run, and Share your Sqlite Code directly from your browser. This online development environment provides you the latest version SQLite v3.20.1.
How to use Online Sqlite Compiler?
Write and Execute Code
- Write your program (or, paste it) directly under the "Source Code" tab.
- If you want to save your program, go to the "Project" menu and save it.
- You can directly execute your program without saving it by clicking on on "Execute" button.
User Input
The latest version of Coding Ground allows to provide program input at run time from the termnial window exactly the same way as you run your program at your own computer. So simply run a program and provide your program input (if any) from the terminal window available in the right side.
Online Sqlite Compiler: Keyboard Shortcuts
The following are the keyword shortcut of this Online Sqlite Compiler:
Shortcut | Description |
⌘ + Enter | Run the program |
⌘ + S | Save Project (Login Required) |
⇧ + ⌘ + S | Save As Project |
⌘ + P | New Project |
⌘ + G | Share Project |
⌘ + Z | Undo Editing |
⌘ + Y | Redo Editing |
⌘ + A | Select All Text |
⌘ + X | Cut Selected Text |
⌘ + C | Copy Selected Text |
⌘ + V | Paste Copied Text |
⌘ + F | Search Text |
⌘ + ⌥ + F | Replace Text |
Shortcut | Description |
Ctrl + Enter | Run the program |
Ctrl + S | Save Project |
Shift + Ctrl + S | Save As Project |
Ctrl + G | Share Project |
Ctrl + Z | Undo Editing |
Ctrl + Y | Redo Editing |
Ctrl + A | Select All Text |
Ctrl + X | Cut Selected Text |
Ctrl + C | Copy Selected Text |
Ctrl + V | Paste Copied Text |
Ctrl + F | Search Text |
Ctrl + H | Replace Text |
Online Sqlite Compiler: Save and Share Sqlite Code (Project)
Save Sqlite Project Online
You can save your Sqlite Project with us so that you can access this project later on. To save a project you will need to create a login Id with us. So before you save a project, please create a login Id using a link given at the top right corner of this page.
Share Sqlite Project Online
You can use this feature to share your Sqlite Code with your teachers, classmates and colleagues. Just click Share Button and it will create a short link, which can be shared through Email, WhatsApp or even through Social Media. A shared link will be deleted if it has been passive for almost 3 months.
More Features of Online Sqlite Compiler
- Theme – You can change the current editor's theme from the "Editor Theme" option under "Settings" menu.
- Font Size – You can change the font size of the editor /compiler from from the "Font Size" option under "Settings" menu.
- Tab Size – You can change the tab size from the "Tab Size" option under "Settings" Menu.
- Show/Hide Line Numbers – You can show/hide the line number with the code from the "Show Line Numbers" or "Hide Line Numbers" option under "Settings" Menu.
- And, many more.
Benefits of Using Online Sqlite Compiler
There are several benefits of using the Online Sqlite Compiler to run your Sqlite code:
- Platform independence: You can run your code from any device without taking care of operating systems.
- Convenience: You don't need to install anything for using this.
- No setup required: There is no need for additional setup to run your code.
- Updated version: Our online compiler/editors/terminals are the latest up-to-date.