1

You might also like

You are on page 1of 2

1 A database file is one of the several types of the system object type *FILE.

SQL Server database has two operating system files: a data file and a log
file.
1.Data files contain data and objects such as tables, indexes, stored
procedures, and views.
2.Log files contain the information that is required to recover all
transactions in the database.

2 create database EMP


On Primary
(Name = EMP,
Filename= ‘D:\sql\EMP.mdf’
Size = 2,
Maxsize= Unlimited,
Filegrowth= 2

)
Log on
( Name = EMP,
Filename= ‘D:\sql\EMP.idf’
Size = 2,
Maxsize= Unlimited,
Filegrowth= 2

3 CREATE TABLE WORKER (


WORKER_ID INT PRIMARY KEY,
FIRST_NAME VARCHAR(10),
LAST_NAME VARCHAR(9),
SALARY INT NULL,
JOINING_DATE DATETIME,
DEPARTMENT NUMERIC(7,2) NULL,
dept INT)

4 begin
insert into emp values
(1,'Tep','Dara',500,'2020-01-01',IT,NULL,4)
insert into emp values
(2,'HARDING','MANAGER',9,'02-02-1998',52000,300,3)
insert into emp values
(3,'TAFT','SALES I',2,'01-02-1996',25000,500,3)
insert into emp values
(4,'HOOVER','SALES I',2,'04-02-1990',27000,NULL,3)
end

5
SELECT FIRST_NAME AS "EMPLOYEE NAME" FROM EMPLOYEES;

6
SELECT Name FROM TableName

WHERE salaries BETWEEN 2000;

7
SELECT * FROM Worker ORDER BY FIRST_NAME ASC
8
-Select * from WORKER order by FIRST_NAME ASC, DEPARTMENT DESC;

9
select * from workers where firstname LIKE '%Heang%' and '%Tep%'

10
SELECT 500
FROM Dara
ORDER BY 1500;

11
DELETE FROM DEPARTMENT
WHERE LAST_NAME = 'Chan';

12
DROP TABLE WORKER;

You might also like