/* All Rights Reserved to Eyal Gurfinkel / Datappl.com / Datamaze.co.il */ /* Copying and\or distributing this file and\or its content is only allowed uppon receiving an explicit written approval by the author. */ /* 1. Copy+Paste the following code to the SQL Server Editor. 2. Save As: 'exercise 1 – fines – database import 1.0.1.sql' . */ If(db_id('sqlPractice') IS NULL) create database sqlPractice go use sqlPractice go if OBJECT_ID('fines','U') is not null drop table fines go create table fines ( fineID int, fineDate date, empId int, amount decimal(6,2) ) go if OBJECT_ID('employees','U') is not null drop table employees go create table employees ( empId int, empName varchar(25), worksSince date, ) go if OBJECT_ID('complaints','U') is not null drop table complaints go create table complaints ( complaintId int, compDate date, fineId int, description varchar(200) ) go /* */ insert into fines values (10001,'2017-02-01',1,250), (10002,'2017-03-11',2,250), (10003,'2017-06-25',4,500), (10004,'2017-07-23',4,250), (10005,'2017-10-01',2,500), (10006,'2017-11-02',2,750), (10007,'2017-11-30',3,1000), (10008,'2017-12-03',1,250) go insert into employees values (1,'Moshe','2007-01-01'), (2,'Avi','2008-07-01'), (3,'Dina','2013-01-01'), (4,'Gila','2017-01-01') go insert into complaints values (1010,'2017-02-24',10001,'#$%$%^$!'), (1011,'2017-08-01',10003,'##$&&!'), (1012,'2017-07-30',10004,'%$#&*&$#!'), (1013,'2017-03-02',10001,'$#^*&#!'), (1014,'2017-11-10',10006,'&$(!'), (1015,'2017-12-04',10007,'*&%()#!'), (1016,'2017-12-08',10007,'8&(^$%$!') go select top 100 * from fines select top 100 * from employees select top 100 * from complaints /* STOP COPYING RIGHT BEFORE THIS LINE */ /* © כל הזכויות שמורות לאייל גורפינקל ול-Datamaze/Datappl, 2017 הקריאה והשימוש בתכנים בהתאם לתקנון האתר. http://www.datappl.com | http://www.datamaze.co */