DBM Lab 1 20092023 024213pm
DBM Lab 1 20092023 024213pm
Management System
SEMESTER BSIT 04
Syntax:
Example 1
Select * from Emp;
Selects all the employees records from the database and displays its columns.
Example 2
Select FirstName, LastName from Emp;
Then there are some functions that can be used in select statement syntax is
Syntax:
SELECT function(<column list>)
Function are SUM, COUNT, DISTINCT, AVG, MIN and MAX there are many other
function that are also available.
Example 3
SELECT COUNT(*)
Department of Computer Sciences
CSL-220: Database Management System Lab 01: Basic SELECT statement of SQL
FROM emp;
Example 4
SELECT COUNT(DISTINCT sal)
FROM emp;
FROM clause and defines what conditions a record has to meet before it will be shown.
Syntax:
SELECT function(<column list>)
[WHERE]<condition>]
Example 5
SELECT ename,deptno,sal
FROM emp
3. Get the highest and the lowest salary from emp table.
5. Display all the deptno that employees belong to, but don’t allow repetition.
10. Display the employee name whose salary is more than 2000 but less than 3500.
11. Display all employee names and their manager number from emp table.