SHARE
TWEET

Untitled

a guest Aug 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE nacar_ProductNorth(
  2.     p_code NUMERIC (6,0) PRIMARY KEY NOT NULL,
  3.     p_descript VARCHAR(25) NOT NULL,
  4.     price NUMERIC (4,2) NOT NULL
  5. );
  6.  
  7. INSERT INTO nacar_ProductNorth VALUES
  8. (123456, 'Flashlight', 5.26),
  9. (123457, 'Lamp', 25.15),
  10. (123458, 'Box Fan', 10.99),
  11. (213345, '9v battery', 1.92),
  12. (254467, '100W bulb', 1.47),
  13. (311452, 'Powerdrill', 34.99);
  14.  
  15. CREATE TABLE nacar_ProductSouth(
  16.     p_code NUMERIC (6,0) PRIMARY KEY NOT NULL,
  17.     p_descript VARCHAR(25) NOT NULL,
  18.     price NUMERIC (5,2) NOT NULL
  19. );
  20.  
  21. INSERT INTO nacar_ProductSouth VALUES
  22. (345678, 'Microwave', 160.00),
  23. (345679, 'Dishwasher', 500.00),
  24. (123458, 'Box Fan', 10.99);
  25.  
  26. SELECT * FROM nacar_ProductNorth
  27. UNION
  28. SELECT * FROM nacar_ProductSouth
  29. ORDER BY p_code ASC;
  30.  
  31. UPDATE tablename
  32. SET toupdate = rightvalue
  33. WHERE toupdate = wrongvalue;
  34.  
  35. SELECT * FROM nacar_ProductNorth
  36. INTERSECT
  37. SELECT * FROM nacar_ProductSouth
  38. ORDER BY p_code ASC;
  39.  
  40. CREATE TABLE nacar_Sales2019_Quarter1(
  41.     s_agent VARCHAR(10) NOT NULL,
  42.     s_amount NUMERIC(8,2) NOT NULL
  43. );
  44.  
  45. INSERT INTO nacar_Sales2019_Quarter1 VALUES
  46. ('Mike', 150000.25),
  47. ('Jon', 132000.75),
  48. ('Mary', 100000.00);
  49.  
  50. CREATE TABLE nacar_Sales2019_Quarter2(
  51.     s_agent VARCHAR(10) NOT NULL,
  52.     s_amount NUMERIC(8,2) NOT NULL 
  53. );
  54.  
  55. INSERT INTO nacar_Sales2019_Quarter2 VALUES
  56. ('Mike', 120000.25),
  57. ('Jon', 142000.75),
  58. ('Mary', 100000.00);
  59.  
  60. SELECT * FROM nacar_Sales2019_Quarter1
  61. UNION
  62. SELECT * FROM nacar_Sales2019_Quarter2
  63. ORDER BY s_agent ASC;
  64.  
  65. SELECT * FROM nacar_Sales2019_Quarter1
  66. UNION ALL
  67. SELECT * FROM nacar_Sales2019_Quarter2
  68. ORDER BY s_agent ASC;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top