dbms
dbms
3
Problem Statement : Write SQL queries using Logical Operators
create table Companyy(E_ID number(10),E_Name char(20),E_Salary number(20));
Select*from Companyy
Output:-
1)AND
Output:-
2)OR
Output:-
3)NOT
Output:-
5)BETWEEN
Select E_Name from Companyy where E_Id BETWEEN 101 and 104;
Output:-
6)IN
Output:-
Practical No. 4
Problem Statement : Create a database and perform the following
operations:-
Create table Employee(E_Id number(5) primary key, Name char(20), Age number(2),Salary
number(6));
Arithmetic Operations-
Output:-
2)Subtract Operator (-)
Output-
Output:-
Output:-
Relational Operations-
Output:-
Output:-
3)Less than Operator (<=)
Output:-
Output:-
Output:-
Group By Clause-
select count(E_ID), Salary from Employee Group by Salary;
Output:-
Having Clause-
select count(E_ID), Salary from Employee Group by Salary having count(E_ID) >= 2;
Output-
select E_ID, Name, Salary from Employee where Name like 'N%';
Output-
Practical No. 5
Problem Statement : To perform various integrity constraints on
relational database.
create table Students(S_Id number(5) primary key, Name char(25), Age number(3));
1)Domain Constraints-
Output-
Output-
3)Key constraints-
Output-
Table 1-
Create table Dept(D_No number(2) primary key, D_Name char(25));
Insert into Dept values('1', 'CSE');
Select * from Dept;
Table 2-
Create table Student12(S_Id number(5) primary key, Name char(20), Age number(2), D_No
number(2) references Dept(D_No));
Insert into Student12 values('001',Bhawna,'20','1');
Select * from Student12;