Created
September 17, 2018 01:05
-
-
Save Alexiskjg16/299dcd5238072f4c4c761609202e4f0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Time: 0.009s | |
CompanyDatabase> Select * from Employees | |
+------+----------------------+----------+--------------------+------------------+--------------+---------------------+ | |
| id | fullname | salary | position | phoneextension | isparttime | parkingspotnumber | | |
|------+----------------------+----------+--------------------+------------------+--------------+---------------------| | |
| 1 | Teagan Elle Wick | <null> | secretary | 123.0 | false | <null> | | |
| 3 | Indigo Lane | 100000 | CEO | <null> | false | <null> | | |
| 4 | Sue Jay Jones | 100000 | frontend Developer | 453.0 | false | <null> | | |
| 5 | Sydney Lue Something | 450 | software developer | <null> | false | <null> | | |
| 2 | Haley Joan Greeves | 500 | cook | 321.0 | false | <null> | | |
+------+----------------------+----------+--------------------+------------------+--------------+---------------------+ | |
SELECT 5 | |
Time: 0.032s | |
CompanyDatabase> ALTER TABLE Employees ADD COLUMN DepartmetID INTEGER REFERENCES Department(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
relation "department" does not exist | |
Time: 0.014s | |
CompanyDatabase> ALTER TABLE Employees ADD COLUMN DepartmentID INTEGER REFERENCES Departments(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
ALTER TABLE | |
Time: 0.014s | |
CompanyDatabase> select * from Employees | |
+------+----------------------+----------+--------------------+------------------+--------------+---------------------+----------------+ | |
| id | fullname | salary | position | phoneextension | isparttime | parkingspotnumber | departmentid | | |
|------+----------------------+----------+--------------------+------------------+--------------+---------------------+----------------| | |
| 1 | Teagan Elle Wick | <null> | secretary | 123.0 | false | <null> | <null> | | |
| 3 | Indigo Lane | 100000 | CEO | <null> | false | <null> | <null> | | |
| 4 | Sue Jay Jones | 100000 | frontend Developer | 453.0 | false | <null> | <null> | | |
| 5 | Sydney Lue Something | 450 | software developer | <null> | false | <null> | <null> | | |
| 2 | Haley Joan Greeves | 500 | cook | 321.0 | false | <null> | <null> | | |
+------+----------------------+----------+--------------------+------------------+--------------+---------------------+----------------+ | |
SELECT 5 | |
Time: 0.012s | |
CompanyDatabase> select * from Departments | |
+------+-----------+------------+ | |
| id | section | isuseful | | |
|------+-----------+------------| | |
| 1 | 11 | true | | |
| 2 | 13 | true | | |
| 3 | 15 | false | | |
+------+-----------+------------+ | |
SELECT 3 | |
Time: 0.022s | |
CompanyDatabase> CREATE TABLE Products (id SERIAL PRIMARY KEY, size VARCHAR(1) NOT NULL, color VARCHAR(100)); | |
CREATE TABLE | |
Time: 0.036s | |
CompanyDatabase> INSERT INTO Products (size, color) VALUES ('S', 'blue'); | |
INSERT 0 1 | |
Time: 0.019s | |
CompanyDatabase> INSERT INTO Products (size, color) VALUES ('M', 'red'); | |
INSERT 0 1 | |
Time: 0.008s | |
CompanyDatabase> INSERT INTO Products (size, color) VALUES ('L', 'yellow'); | |
INSERT 0 1 | |
Time: 0.008s | |
CompanyDatabase> SELECT * FROM Products | |
+------+--------+---------+ | |
| id | size | color | | |
|------+--------+---------| | |
| 1 | S | blue | | |
| 2 | M | red | | |
| 3 | L | yellow | | |
+------+--------+---------+ | |
SELECT 3 | |
Time: 0.010s | |
CompanyDatabase> CREATE TABLE Orders (id SERIAL PRIMARY KEY, Zipcode INT, isfreeshipping VARCHAR(10)); | |
CREATE TABLE | |
Time: 0.020s | |
CompanyDatabase> INSET INTO Orders (zipcode, isfreeshipping) VALUES (34250, 'true'); | |
syntax error at or near "INSET" | |
LINE 1: INSET INTO Orders (zipcode, isfreeshipping) VALUES (34250, '... | |
^ | |
Time: 0.011s | |
CompanyDatabase> INSERT INTO Orders (zipcode, isfreeshipping) VALUES (34250, 'true'); | |
INSERT 0 1 | |
Time: 0.021s | |
CompanyDatabase> INSERT INTO Orders (zipcode, isfreeshipping) VALUES (66048, 'false'); | |
INSERT 0 1 | |
Time: 0.008s | |
CompanyDatabase> INSERT INTO Orders (zipcode, isfreeshipping) VALUES (66043, 'false'); | |
INSERT 0 1 | |
Time: 0.008s | |
CompanyDatabase> INSERT INTO Orders (zipcode, isfreeshipping) VALUES (34205, 'true'); | |
INSERT 0 1 | |
Time: 0.007s | |
CompanyDatabase> select * from orders | |
+------+-----------+------------------+ | |
| id | zipcode | isfreeshipping | | |
|------+-----------+------------------| | |
| 1 | 34250 | true | | |
| 2 | 66048 | false | | |
| 3 | 66043 | false | | |
| 4 | 34205 | true | | |
+------+-----------+------------------+ | |
SELECT 4 | |
Time: 0.009s | |
CompanyDatabase> ALTER TABLE Products ADD COLUMN Orderid INTEGER REFERENCES Orders(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
ALTER TABLE | |
Time: 0.006s | |
CompanyDatabase> ALTER TABLE Orders ADD COLUMN Productid INTEGER REFERENCES Products(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
ALTER TABLE | |
Time: 0.004s | |
CompanyDatabase> CREATE TABLE ProductOrders (id SERIAL PRIMARY ID, ProductID INT, OrderID INT) | |
syntax error at or near "ID" | |
LINE 1: CREATE TABLE ProductOrders (id SERIAL PRIMARY ID, ProductID ... | |
^ | |
Time: 0.014s | |
CompanyDatabase> CREATE TABLE ProductOrders (id SERIAL PRIMARY KEY, ProductID INT, OrderID INT); | |
CREATE TABLE | |
Time: 0.030s | |
CompanyDatabase> DROP TABLE ProductORders | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
DROP TABLE | |
Time: 0.016s | |
CompanyDatabase> CREATE TABLE ProductOrders (id SERIAL PRIMARY KEY); | |
CREATE TABLE | |
Time: 0.023s | |
CompanyDatabase> ALTER TABLE ProductOrders ADD COLUMN Productid INTEGER REFERENCES Products(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
ALTER TABLE | |
Time: 0.005s | |
CompanyDatabase> ALTER TABLE ProductOrders ADD COLUMN Orderid INTEGER REFERENCES Orders(id) | |
You're about to run a destructive command. | |
Do you want to proceed? (y/n): y | |
Your call! | |
ALTER TABLE | |
Time: 0.003s | |
CompanyDatabase> select * from productorders | |
+------+-------------+-----------+ | |
| id | productid | orderid | | |
|------+-------------+-----------| | |
+------+-------------+-----------+ | |
SELECT 0 | |
Time: 0.013s | |
CompanyDatabase> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment