0% found this document useful (0 votes)
5 views8 pages

Class 13

The document discusses various SQL operations including backup methods, advanced update and delete statements, and the use of joins and subqueries. It explains the functionality of 'Exist' and 'Not Exist' clauses in queries, as well as the role of DCL and TCL commands in managing access and transaction control. Additionally, it highlights the importance of roles in systems like Power BI for managing user permissions.

Uploaded by

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

Class 13

The document discusses various SQL operations including backup methods, advanced update and delete statements, and the use of joins and subqueries. It explains the functionality of 'Exist' and 'Not Exist' clauses in queries, as well as the role of DCL and TCL commands in managing access and transaction control. Additionally, it highlights the importance of roles in systems like Power BI for managing user permissions.

Uploaded by

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

Class 13

we have two ways taking backup

One

another one :

Using sub query:

advance update statement.

problem statement: I need department name within table permanently.

we can use below update query to update.


Here : instead of were condition we are using joins
Increasing salary of analytics department only

we can achieve it in two ways

one : joins

join and then where , then join

another: sub query


Advance Delete Statement.

deleting all the dep id , from employee table , which are not present in dep table.

note : for delete , we don’t require column , for update we require column

delete is justi deleting row using where clause.

deleting department using : using joins

Execution : Joins , where , delete

Joins are used , when we need column from another

Exist and Non Exsit Clause

are used in where clause

Exist returns True / False


True : will return the rows
False : will not return the rows.

how it works

each row from employes goes and check in dep table , whether it is present or not.

if it is present exist will return true , return 1 or more mores , if it is false then it returns 0

1, is used for returning rows [ for checking ]

it checks , whether it is returning 1 or more rows

it's not efficient, as it will check each employee with department id column , until it macth , if match
found , it stops and return true else false .

for each row , it run’s inner query .

its just one where condition , after that we can use joins , sub query or what ever

not exist [ it is opposite to exist ]

where it returns which is not present in , another table.

in sub query [ virtual table ]

is independent sub query, were, it return the data , does not run again and again
outer quey will compare against the result from inner query

co related sub query.

each row from empl table will visit dep by row by row again and again

but in here , outer quey will run inner query every time

DCL command

when giving access we use “to”


while removing access we use “from”

for all the users we use public


we can revoke access on employee table for all users using public.

Roles :

in power bi we have have concept of RLS , similar to that we have role ,

were , we can create role , and add members to to it , we can give access to role instead for invidual
persons

TCL Commands

Are used with DML commands

we cannot use with DDL , create, alter , truncate

TCL commands comes into use DML ( insert , delete , update )


rollback :

what ever happens b/w this two will be rollbacked , which will not effect the main data.

You might also like