create a table employee with 4 attributes (ID,name,department,salary)and apply primary key on ID column and insert minimum 3 tuples in this table?
Answers
Create table employee
(
ID int,
Name varchar(10),
Department varchar(10),
Salary int,
Primary Key (ID)
);
Insert into employee (ID, Name, Department, Salary) values(‘1’, ‘abc’, ‘computer’, ‘20000’);
Insert into employee (ID, Name, Department, Salary) values(‘2’, ‘def’, ‘english’, ‘20000’);
Insert into employee (ID, Name, Department, Salary) values(‘3’, ‘ghi’, ‘math’, ‘20000’);
Insert into employee (ID, Name, Department, Salary) values(‘4’, ‘jkl’, ‘chemistry’, ‘20000’);
ID Name Department Salary
Ert345 Salman Sales department 20000
Rty567 John Support department 30000
Muy533 Ronny HR department 40000
Here I have added the primary key on the ID column for each employee and created their records.
Four attributes are ID, Name, Salary and the Department.
First I have added the attributes and listed the employee name based on the amount of salary they get in the ascending order.