CREATE TABLE customer_return (
Product_ID INTEGER,
Product_Description TEXT
);
INSERT INTO customer_return(Product_ID, Product_Description)
VALUES ("0001", "Nike Shoes");
INSERT INTO customer_return(Product_ID, Product_Description)
VALUES ("0002", "Adidas Shoes");
SELECT * FROM customer_return;
CREATE table inventory (
Inventory_ID NOT NULL,
Inventory_Name NOT NULL,
Inventory_Desc TEXT
);
INSERT INTO inventory (Inventory_Name, Inventory_Desc) VALUES ("MacBook", "Apple Laptop");
# Error while executing SQL query on database 'test': NOT NULL constraint failed: inventory.Inventory_ID
CREATE table inventory (
Inventory_ID NOT NULL,
Inventory_Name NOT NULL,
Inventory_Desc TEXT
);
INSERT INTO inventory (Inventory_ID, Inventory_Name, Inventory_Desc) VALUES ("001", "MacBook", "Apple Laptop");
SELECT * FROM inventory;
DROP TABLE IF EXISTS inventory;
CREATE table inventory (
Inventory_ID NOT NULL,
Inventory_Item_Name NOT NULL,
Inventory_Desc TEXT DEFAULT "Refers to Inventory_Item_Name"
);
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("001", "MacBook");
SELECT * FROM inventory;
DROP TABLE IF EXISTS inventory;
CREATE table inventory (
Inventory_ID INTEGER UNIQUE,
Inventory_Item_Name NOT NULL,
Inventory_Desc TEXT DEFAULT "Refers to Inventory_Item_Name"
);
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("001", "MacBook");
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("001", "MacBook Pro");
SELECT * FROM inventory;
# Error while executing SQL query on database 'test': UNIQUE constraint failed: inventory.Inventory_ID
DROP TABLE IF EXISTS inventory;
CREATE table inventory (
Inventory_ID INTEGER UNIQUE,
Inventory_Item_Name NOT NULL,
Inventory_Desc TEXT DEFAULT "Refers to Inventory_Item_Name"
);
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("001", "MacBook");
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("002", "MacBook Pro");
SELECT * FROM inventory;
DROP TABLE IF EXISTS inventory;
CREATE table inventory (
Inventory_ID INTEGER UNIQUE NOT NULL,
Inventory_Item_Name NOT NULL,
Inventory_Desc TEXT DEFAULT "Refers to Inventory_Item_Name"
);
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES (NULL, "MacBook");
INSERT INTO inventory (Inventory_ID, Inventory_Item_Name) VALUES ("002", "MacBook Pro");
SELECT * FROM inventory;
# Error while executing SQL query on database 'test': NOT NULL constraint failed: inventory.Inventory_ID
DROP TABLE IF EXISTS inventory;
CREATE table inventory (
Inventory_ID INTEGER PRIMARY KEY,
Inventory_Item_Name NOT NULL,
Inventory_Desc NAME
);
INSERT INTO inventory (Inventory_Item_Name, Inventory_Desc) VALUES ("MacBook", "Apple laptop");
INSERT INTO inventory (Inventory_Item_Name, Inventory_Desc) VALUES ("MacBook Pro", "Apple higher spec laptop");
SELECT * FROM inventory;