Advertisement
horozov86

Task 1 - SQL

Aug 19th, 2024
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a) без филтриране по INFO1
  2.  
  3. SELECT
  4.     AUFTRAGSNUMMER AS "Order number",
  5.     DATUMAEXTERN AS "Order date created",
  6.     KUNDENNR AS "BP number",
  7.     NAME1 AS "Name of the client",
  8.     MAINLAND AS "Country of the client",
  9.     BSBELADESTART AS "Loading date start",
  10.     BSBELADEEND AS "Loading date end",
  11.     ESENTLADESTART AS "Unloading date start",
  12.     ESENTLADEEND AS "Unloading date end",
  13.     ABS_ORT1 AS "Loading City",
  14.     EMP_ORT1 AS "Unloading City"
  15. FROM
  16.     AKOPF
  17. LEFT JOIN
  18.     SKUNDEN ON SKUNDEN.NR = AKOPF.FRACHTAGNR
  19. LEFT JOIN
  20.     ASENDUNG ON AKOPF.NR = ASENDUNG.AKOPFNR;
  21.  
  22.  
  23.  
  24. б) Полето INFO1 не е празно и не съдържа само space-ове
  25.  
  26. SELECT
  27.     AUFTRAGSNUMMER AS "Order number",
  28.     DATUMAEXTERN AS "Order date created",
  29.     KUNDENNR AS "BP number",
  30.     NAME1 AS "Name of the client",
  31.     MAINLAND AS "Country of the client",
  32.     BSBELADESTART AS "Loading date start",
  33.     BSBELADEEND AS "Loading date end",
  34.     ESENTLADESTART AS "Unloading date start",
  35.     ESENTLADEEND AS "Unloading date end",
  36.     ABS_ORT1 AS "Loading City",
  37.     EMP_ORT1 AS "Unloading City"
  38. FROM
  39.     AKOPF
  40. LEFT JOIN
  41.     SKUNDEN ON SKUNDEN.NR = AKOPF.FRACHTAGNR
  42. LEFT JOIN
  43.     ASENDUNG ON AKOPF.NR = ASENDUNG.AKOPFNR
  44. WHERE
  45.     TRIM(ASENDUNG.INFO1) <> ' ';
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement