Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
exercise 1 – fines – database import 1.0.1.sql
--Sql Server 2014 Express Edition --Batches are separated by 'go' select @@version as 'sql server version' 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
run
|
edit
|
history
|
help
0
Movies
search all tables for string
Extracting Id No
tt
ss
SUPPLIER
pivot example
a
SQL query to find difference in text between different rows
comparison and logical