0% found this document useful (0 votes)
41 views16 pages

NOthing

This document covers topics in Unit II including: 1) Fundamental and additional SQL operations such as select, where, from, union, aggregate functions, null values, embedded SQL, dynamic SQL, views, joins, and integrity constraints. 2) Key concepts related to security and authorization in databases like granting privileges, roles, audit trails, and encryption. 3) Distributed databases and client/server architectures.

Uploaded by

GanesanDCCE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views16 pages

NOthing

This document covers topics in Unit II including: 1) Fundamental and additional SQL operations such as select, where, from, union, aggregate functions, null values, embedded SQL, dynamic SQL, views, joins, and integrity constraints. 2) Key concepts related to security and authorization in databases like granting privileges, roles, audit trails, and encryption. 3) Distributed databases and client/server architectures.

Uploaded by

GanesanDCCE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

UNIT - II

Fundamental Operations of SQL


Additional Operations
Advance SQL
SQL Fundamentals
Embedded SQL
Dynamic SQL

UNIT - II
Basic Structure
Select .. From .. Where
Select -
All
Particular field
ALL & Distinct

Eg: SQL select * from loan;
UNIT - II
Where clause
And
Or
Simple B1=10
Where b1= 10 and b2 = 12
where Q1 U Q2

UNIT - II
From - Clause
U can select one file or multiple file
By from employee;
Or employee e, work w;

eg : writing Query

Select name, rollno, age
From Student
Where rollno = 101;


UNIT - II
Advance & Additional Set Operation of SQL

Union, Intersection, Difference- set operation
<Query1> U <Query 2>

Ex: (select customer_name from depositor) Union (select
custome_name from borrower)

Aggregate Functions avg, min, max, sum, count
Eg :SQL>Select avg(salary) from employee

Unit - II
Null Values
SQL> Select loan_number from loan where amount is null

The Aggregate avg, min, max, sum, count expect the
count ignore the null values in their inputs

SQL allows use of null values to indicate absence of
information

We can use the special keyword null in a predicate to test
for a null value
SQL> Select sum(amount) from loan;
Unit - II
Embedded SQL
EXEC SQL< Embedded Sql Statement>
END-EXEC
:Eg
EXEC SQL
DECLARE
A INTERGER
BEGIN
PROCESS
END
END-EXEC

UNIT - II
Dynamic SQL

Allows program to construct and submit SQL queries at
runtime
eg: char* sqlprog=update account set balance=
balance*0.15 where account_no =?;

Language support for connecting database:
ODBC -MS-ACCESS
JDBC -JAVA


UNIT- II
Nested Queries and Join
Set membership :in , not in
Eg ; SQl> select customer_name from borrower
where custome_name in (select
Customer_name from depositer);
Set Comparison:
>some,>all,<some,<=some,<>some,=some
Empty relation test:
exists , not exists
Support : expect
Join inner join/natural loin, left join, right join, full join


UNIT- II
View
Create view V as < query expression>
Eg : create view as Customer_all as (select branch_name,
customer_name from deposite,account
Where deposit.account_no=account.account_no);
View can create from single table and also from two table
But when you do DML operation on the view what happen?
Check it when you create view from single table do DML
command on it
Check it when you create view from two table do Dml
command on it
UNIT- II
Integrity
Security
Distributed Databases and Client/Server
Databases
UNIT- II
Integrity

Ensure that changes made to the database by authorized users do
not result in a loss of Data consistency.
In addition to that accidental damage to the Database.

Key declaration primary key, super key, foreign key, candidate key
Form of a relation :M->M , M->One, One->M

In addition in that all Triggers are used to ensure some types of
integrity



UNIT- II
Integrity
Eg :
Create domain Dollar numeric(12,2)
Create domain Dollar numeric(12,2)
although both are same data type it will show syntax error this is
due to programmer forget about the difference in currency.

Referential Integrity value appear in the one relation also appear
same in the other relation also
in sql it was down by foreign key
Database modification insert,delete,update
Assertion is a predicate expression a condition that we wish the
database always to satisfy
Eg: sum of all loan ammount for each branch must be less than the
sum of account balance at the branch


UNIT- II
Security and Authorization
The data stored in the database need protection from
unauthorized access and malicious destruction or alteration.

Security Violation
unauthorized reading, modification, destruction

Database Security, Database system,
OS system, Network, Physical, Human


UNIT- II
Authorization

Granting of Privileges

Role

Audit Trails

Encryption and Authentication

UNIT- II
Distributed environment



Client Server

You might also like