SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
DROP TABLE IF EXISTS `Orders`; CREATE TABLE `Orders` ( `order_num` INT(11) NOT NULL, `order_date` datetime NOT NULL, `cust_id` CHAR(10) NOT NULL ); INSERT INTO `Orders` VALUES ("20005", "2004-05-01 00:00:00", "1000000001"), ("20006", "2004-01-12 00:00:00", "1000000003"), ("20007", "2004-01-30 00:00:00", "1000000004"), ("20008", "2004-02-03 00:00:00", "1000000005"), ("20009", "2004-02-08 00:00:00", "1000000001"); DROP TABLE IF EXISTS `Customers`; CREATE TABLE `Customers` (`cust_id` CHAR (10) NOT NULL , `cust_name` CHAR (50) NOT NULL , `cust_address` CHAR (50) NOT NULL , `cust_city` CHAR (50) NULL , `cust_state` CHAR (5) NULL , `cust_zip` CHAR (5) NULL , `cust_country` CHAR (50) NULL , `cust_contact` CHAR (50) NULL , `cust_email` CHAR (50) NULL ); INSERT INTO `Customers`VALUES ("1000000001", " Village Toys", "200 Maple Lane", "Detroit", "MI", "44444", "USA", "John mith", "Ssales@villagetoys.com"), ("1000000002", "Kids Place", "333 South Lake Drive", "Columbus", "OH", "43333", "USA", "Michelle Green", NULL), ("1000000003", "Fun4All", "1 Sunny Place", "Muncie", "IN", "42222", "USA", "Jim Jones", "Jjones@fun4all.com"), ("1000000004", "Fun4All", "829 Riverside Drive", "Phoenix", "AZ", "88888", "USA", "Denise L. Stephens", "mailto:dstephens@fun4all.com"), ("1000000005", " The Toy Store", "545 53rd Street", "Chicago", "IL", "54545", "USA", "Kim Howard", NULL); DROP TABLE IF EXISTS `Vendors`; CREATE TABLE `Vendors` (`vend_id` CHAR (10) NOT NULL , `vend_name` CHAR (50) NOT NULL , `vend_address` CHAR (50) NOT NULL , `vend_city` CHAR(50) NULL , `vend_state` CHAR(5) NULL , `vend_zip` CHAR(10) NULL , `vend_country` CHAR(50) NULL ); INSERT INTO `Vendors`VALUES ("BRS01","Bears R Us","123 Main Steet","Bear Town","MI","44444","USA"), ("BRE02","Bear Emporium","500 Park Steet","Anytown","OH","44333","USA"), ("DLL01","Doll House Inc.","555 High Steet","Dollsville","CA","99999","USA"), ("FRB01","Furball Inc.","1000 5th Avenus","New York","NY","11111","USA"), ("FNG01","Fun and Games","42 Galaxy Road","London",NULL,"N16 6PS","England"), ("JTS01","Jouets et ours","1 Rue Amusement","Paris",NULL,"45678","France") ; SELECT RTRIM (CONCAT(vend_country,vend_city)) FROM Vendors Order By vend_country DROP TABLE IF EXISTS `Products`; CREATE TABLE `Products` (`prod_id` CHAR (10) NOT NULL , `vend_id` CHAR (10) NOT NULL , `prod_name` CHAR (255) NOT NULL , `prod_price` decimal(8,2) NOT NULL , `prod_dese` Text NULL ); INSERT INTO `Products`VALUES ("BR01", "BRS01", "8 inch teddy bear", "5.99", "8 inch teddy bear, comes with cap and jacket"), ("BR02", "BRS01", "12 inch teddy bear", "8.99", "12 inch teddy bear, comes with cap and jacket"), ("BR03", "BRS01", "18 inch teddy bear", "11.99", "18 inch teddy bear, comes with cap and jacket"), ("BNBG01", "DLL01", "Fish bean bag toy", "3.49", "Fish bean bag toy, complete with bean bag worms with which to feed it"), ("BNBG02", "DLL01", "Bird bean bag toy", "3.49", "Brid bean bag toy, eggs are not included"), ("BNBG03", "DLL01", "Rabbit bean bag toy", "3.49", "Rabbit bean bag toy, comes with bean bag carrots"), ("RGAN01", "DLL01", "Ragged Ann", "4.99", "18 inch Raggedy An doll"), ("RYL01", "FNG01", "King doll", "9.49", "12 inch king doll with royal garments and crown"), ("RYL02", "FNG01", "Queen doll", "9.49", "12 inch queen doll with royal garments and crown") ; DROP TABLE IF EXISTS `OrderItems`; CREATE TABLE `OrderItems` ( `order_num` INT(11) NOT NULL, `order_item` INT(11) NOT NULL, `prod_id` CHAR(10) NOT NULL, `quantity` INT(11) NOT NULL, `item_price` DECIMAL(8,2) NOT NULL ); INSERT INTO `OrderItems` VALUES ("20005", " 1", "BR01", "100", "5.49"), ("20005", " 2", " BR03", "100", "10.99"), ("20006", " 1", " BR01", "20", "5.99"), ("20006", " 2", " BR02", "10", "8.99"), ("20006", " 3", " BR03", "10", "11.99"), ("20007", " 1", " BR03", "50", "11.49"), ("20007", " 2", " BNBG01", "100", "2.99"), ("20007", " 3", " BNBG02", "100", "2.99"), ("20007", " 4", " BNBG03", "100", "2.99"), ("20007", " 5", "RGAN01", "50", "4.99"), ("20008", " 1", "RGAN01", "5", "4.99"), ("20008", " 2", " BR03 ", "5", "11.99"), ("20008", " 3", "BNBG01", "10", "3.49"), ("20008", " 4", "BNBG02", "10", "3.49"), ("20008", " 5", "BNBG03", "10", "3.49"), ("20009", " 1", "BNBG01", "250", "2.49"), ("20009", " 2", "BNBG02", "250", "2.49"), ("20009", " 3", "BNBG03", "250", "2.49");
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear