text:  --Problem_01
  CREATE TABLE PERSONS
    (
       PERSONID    INT PRIMARY KEY IDENTITY(1, 1)
       ,FIRSTNAME  NVARCHAR(255)
       ,SALARY     MONEY NOT NULL
       ,PASSPORTID INT NOT NULL
    )
  
  CREATE TABLE PASSPORTS
    (
       PASSPORTID      INT PRIMARY KEY IDENTITY(101, 1)
       ,PASSPORTNUMBER NVARCHAR(8) NOT NULL
    )
  
  ALTER TABLE PERSONS
    ADD FOREIGN KEY (PASSPORTID) REFERENCES PASSPORTS (PASSPORTID)
  
  INSERT INTO PASSPORTS
              (PASSPORTNUMBER)
  VALUES      ('N34FG21B'),
              ('K65LO4R7'),
              ('ZE657QP2')
  
  INSERT INTO PERSONS
              (FIRSTNAME
               ,SALARY
               ,PASSPORTID)
  VALUES      ('Roberto'
               ,43300.00
               ,102),
              ('Tom'
               ,56100.00
               ,103),
              ('Yana'
               ,60200.00
               ,101)
  
  --Problem_02
  CREATE TABLE MODELS
    (
       MODELID         INT PRIMARY KEY IDENTITY(101, 1)
       ,NAME           NVARCHAR(255)
       ,MANUFACTURERID INT NOT NULL
    )
  
  CREATE TABLE MANUFACTURERS
    (
       MANUFACTURERID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME          NVARCHAR(255)
       ,ESTABLISHEDON DATE
    )
  
  ALTER TABLE MODELS
    ADD FOREIGN KEY (MANUFACTURERID) REFERENCES MANUFACTURERS (MANUFACTURERID)
  
  INSERT INTO MANUFACTURERS
              (NAME
               ,ESTABLISHEDON)
  VALUES      ('BMW'
               ,'1916-03-07'),
              ('Tesla'
               ,'2003-01-01'),
              ('Lada'
               ,'1966-05-01')
  
  INSERT INTO MODELS
              (NAME
               ,MANUFACTURERID)
  VALUES      ('X1'
               ,1),
              ('i6'
               ,1),
              ('Model S'
               ,2),
              ('Model X'
               ,2),
              ('Model 3'
               ,2),
              ('Nova'
               ,3)
  
  --Problem_03
  CREATE TABLE STUDENTS
    (
       STUDENTID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME     NVARCHAR(255) NOT NULL
    )
  
  CREATE TABLE EXAMS
    (
       EXAMID INT PRIMARY KEY IDENTITY(101, 1)
       ,NAME  NVARCHAR(255) NOT NULL
    )
  
  CREATE TABLE STUDENTSEXAMS
    (
       STUDENTID INT NOT NULL FOREIGN KEY REFERENCES STUDENTS (STUDENTID)
       ,EXAMID   INT NOT NULL FOREIGN KEY REFERENCES EXAMS (EXAMID),
       PRIMARY KEY(STUDENTID, EXAMID)
    )
  
  INSERT INTO STUDENTS
              (NAME)
  VALUES      ('Mila'),
              ('Toni'),
              ('Ron')
  
  INSERT INTO EXAMS
              (NAME)
  VALUES      ('SpringMVC'),
              ('Neo4j'),
              ('Oracle 11g')
  
  INSERT INTO STUDENTSEXAMS
              (STUDENTID
               ,EXAMID)
  VALUES      (1
               ,101),
              (1
               ,102),
              (2
               ,101),
              (3
               ,103),
              (2
               ,102),
              (2
               ,103)
  
  --Problem_04
  CREATE TABLE TEACHERS
    (
       TEACHERID  INT PRIMARY KEY IDENTITY(101, 1)
       ,NAME      NVARCHAR(255) NOT NULL
       ,MANAGERID INT NULL FOREIGN KEY REFERENCES TEACHERS (TEACHERID)
    )
  
  INSERT INTO TEACHERS
              (NAME
               ,MANAGERID)
  VALUES      ('John'
               ,NULL),
              ('Maya'
               ,106),
              ('Silvia'
               ,106),
              ('Ted'
               ,105),
              ('Mark'
               ,101),
              ('Greta'
               ,101)
  
  --Problem_05
  CREATE TABLE CITIES
    (
       CITYID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME  VARCHAR(50) NOT NULL
    )
  
  CREATE TABLE CUSTOMERS
    (
       CUSTOMERID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME      VARCHAR(50) NOT NULL
       ,BIRTHDAY  DATE
       ,CITYID    INT NOT NULL FOREIGN KEY REFERENCES CITIES (CITYID)
    )
  
  CREATE TABLE ORDERS
    (
       ORDERID      INT PRIMARY KEY IDENTITY(1, 1)
       ,CUSTORMERID INT NOT NULL FOREIGN KEY REFERENCES CUSTOMERS (CUSTOMERID)
    )
  
  CREATE TABLE ITEMTYPES
    (
       ITEMTYPEID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME      VARCHAR(50) NOT NULL
    )
  
  CREATE TABLE ITEMS
    (
       ITEMID      INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME       VARCHAR(50) NOT NULL
       ,ITEMTYPEID INT NOT NULL FOREIGN KEY REFERENCES ITEMTYPES (ITEMTYPEID)
    )
  
  CREATE TABLE ORDERITEMS
    (
       ORDERID INT NOT NULL FOREIGN KEY REFERENCES ORDERS (ORDERID)
       ,ITEMID INT NOT NULL FOREIGN KEY REFERENCES ITEMS (ITEMID),
       PRIMARY KEY (ORDERID, ITEMID)
    )
  
  --Problem_08
  CREATE TABLE MAJORS
    (
       MAJORID INT PRIMARY KEY IDENTITY(1, 1)
       ,NAME   VARCHAR(50)
    )
  
  CREATE TABLE STUDENTS
    (
       STUDENTID      INT PRIMARY KEY IDENTITY(1, 1)
       ,STUDENTNUMBER VARCHAR(50)
       ,STUDENTNAME   VARCHAR(50)
       ,MAJORID       INT NOT NULL FOREIGN KEY REFERENCES MAJORS (MAJORID)
    )
  
  CREATE TABLE PAYMENTS
    (
       PAYMENTID      INT PRIMARY KEY IDENTITY(1, 1)
       ,PAYMENTDATE   DATE NOT NULL DEFAULT Cast(Getdate() AS DATE)
       ,PAYMENTAMOUNT MONEY NOT NULL
       ,STUDENTID     INT NOT NULL FOREIGN KEY REFERENCES STUDENTS (STUDENTID)
    )
  
  CREATE TABLE SUBJECTS
    (
       SUBJECTID    INT PRIMARY KEY IDENTITY(1, 1)
       ,SUBJECTNAME VARCHAR(50)
    )
  
  CREATE TABLE AGENDA
    (
       STUDENTID  INT NOT NULL FOREIGN KEY REFERENCES STUDENTS (STUDENTID)
       ,SUBJECTID INT NOT NULL FOREIGN KEY REFERENCES SUBJECTS (SUBJECTID),
       PRIMARY KEY (STUDENTID, SUBJECTID)
    )
  
  --Problem_09
  SELECT [MOUNTAINRANGE]
         ,[PEAKNAME]
         ,[ELEVATION]
  FROM   [DBO].[PEAKS]
         JOIN [DBO].[MOUNTAINS]
           ON [DBO].[MOUNTAINS].[ID] = [MOUNTAINID]
  WHERE  [MOUNTAINRANGE] = 'Rila'
  ORDER  BY [ELEVATION] DESC  