SHARE
TWEET

Untitled

a guest Dec 11th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use Student
  2.  
  3. SELECT * FROM student_1
  4. INSERT INTO student_1 VALUES ('50204912485', 'Onur', 'Vassiljev', '58581201', 'Puru 20', 'Johvi', '31234')
  5.  
  6. SELECT *
  7. INTO Students.dbo.student
  8. FROM student_1
  9.  
  10.  
  11.  
  12. use Students
  13.  
  14. SELECT * FROM student
  15.  
  16. CREATE TABLE profession (id_profession INTEGER IDENTITY(10000,1) NOT NULL CONSTRAINT PK_id_profession PRIMARY KEY,
  17.  name_profession CHAR(30) NOT NULL,
  18.  short_name CHAR(2),
  19.  date_reg DATE DEFAULT getDate())
  20.  
  21. INSERT INTO profession (name_profession, short_name) VALUES('noorem tarkvaraarendaja', 'TV'),('keevitaja', 'KV')
  22.  
  23. CREATE TABLE ruhm (id_group CHAR(10) NOT NULL CONSTRAINT PK_id_group PRIMARY KEY,
  24.     school CHAR(15) NOT NULL DEFAULT 'pohikool', CHECK (school IN ('pohikool', 'kesk kool')),
  25.     languageGroup CHAR(15) NOT NULL DEFAULT 'vene', CHECK (languageGroup IN ('vene', 'eesti')),
  26.     city CHAR(15) NOT NULL DEFAULT 'Johvi', CHECK (city IN ('Johvi', 'Sillamae')),
  27.     groupDate_reg DATE NOT NULL DEFAULT getDate(),
  28.     profession INTEGER NOT NULL,
  29.     CONSTRAINT FK_profession FOREIGN KEY(profession) REFERENCES profession (id_profession))
  30.  
  31. INSERT INTO ruhm VALUES ('JPTVR18','pohikool','vene','Johvi',DEFAULT,10000)
  32. INSERT INTO ruhm VALUES ('JKKKR19','pohikool','eesti','Sillamae',DEFAULT,10001)
  33.  
  34. CREATE TABLE opimine (sudent char(11) NOT NULL,
  35.     ruhm CHAR(10) NOT NULL,
  36.     start DATE NOT NULL DEFAULT getDate(),
  37.     finish DATE NULL,
  38.     status CHAR(20) NOT NULL, CHECK(status IN ('study','finish','expelled'))
  39.     CONSTRAINT PK_opimine PRIMARY KEY (sudent, ruhm))
  40.  
  41. INSERT INTO opilane VALUES (50208302215,'JPTVR18','2018-09-01',NULL,'study'),
  42.     (50405028515,'KTVRI18','2017-09-01',DEFAULT,'finish'),
  43.     (40405028512,'JKKKR19','2017-09-01','2017-12-06','expelled')
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