0% found this document useful (0 votes)
30 views5 pages

?SQL Commands?interview Series

Uploaded by

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

?SQL Commands?interview Series

Uploaded by

Ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
SQL COMMANDS [S@L_ commands ]:- © Sgk commands are fnstructlons. ff is Used po Communicate with the database. Ir Ps als0 ysed fo perform Speureic asks, funcefons, and queries of data. SOL can perform Varfouc tasks Like Create a fable, add dora 7° yasies, drop the table, MOMAy phe table. Se Pemlssion for user. [Tepes of SG Command s :- a There are Ave types OF SG Commands.‘ SQL Command, ELEGRADL RUT ES GALLERY, 4. Doda Defination Language (DDL) * DDL changes the stvucture F phe Cale Like creating 9 tole, deteting a table, aittying 4 table, ec. * All the Commands OF DDL are auto - COmmited phat means tt permanently saue au ne changes Mn the database. AAR CAINKEDIL): DL OLLLLL UL dd dd ddd dc/c/c/e/ee ee eessse -< IU UU UU ddd ddd eee ceeeeeeoeu% Hese are some commands 4hat Come Onder DDL.- > CREATE ? ALTER > Drop > TRUACATE 9). CREATE Dt is used 40 Create 4 new table in phe detabase . Syntax CREATE TABLE. NAME (coLumal_naAmE DaraTyre ) Exampte :- CRenre Tagce Emproyee Calame varcyar2 (20), Email] Vv 6): DROP :- Lt is used to delete oth the Structure and rewrd shred In the table. Syntax © DROP TABLE table_name, Geample:- DROP TABLE EmPLOyYEE; ANNE Koma (unKeDin). ©). ALTER: TELEGRAM NwTES WHteery,| Lr is Used tO alter the structure of the database. This could be either 4o Modify the charactevistcs Of an existing ottyibute or probably 4 add a new attribute. SYMOn ALTER TABLE table-n@me ADP ‘Column_ name datatype; Example :- 4 ALTER TABLE STU. DETAILS ADD ( ADORESS VARCHAR 2 (20) i ALTER TaBle STV. Deraris pyodiFy (WAaMe vaRcnaR 2 (207); QOGOOD ULL LUC Ud dd dd ddd de eeeeeeesee ae 4). TRUNCATE :- ft fs used to depete all the vows from the toble and Free the space contening the table. Syntax: TRUNCATE TABLE table. name Example: TRUNCATE TABLE EmPLoyee } u_ Koma CLINKEDIN) - ecey AM NOTES GALLERY. 2- DATA ManiPuzation LANGUAGE (DML) Dmt commands are used 10 modify the, cdetabase- It is responsible for ali foim of Changes In fre databace. The Command of DML is not autd- Ommitea- © Insert + Update + Deete. a) INSERT :- jhe [cert is statement js Sar Query. Lt is Used fo Insert data Into the youd of a tasie. Syntax . Insert into TARLE_NAME valves (Vauel, Value 2, Varue3-... Value nN): 6): UppaTe:- his Command used fo update ox modify pre value of a eolumn 3n the tosle. Syntax - UpDaTe tebie_name cer [column_namet = Value 4, ... tetumn ) c). Devere :- St is used 40 remove one OF MI0re you From Q ede - Example '- DeveTe FROM jowapeint WERE fruthor =" funoo"; 1 KoA (Linkeoin) - 3. DATA Connol Language (DcL) Dect commands are used tO grant and revorKe authority from any database user © Grant * Revore 9): GRANT :- It }s used to give user access privileges to databace. Eyample :- , Grant SELECT, UPDATE ON My_ TABLE TO SOME_USER , A b REVOKE :- Tt fs used fo ree back permissions From the user. 4. “TRANSACTION ConTRoL LANGUAGE (TcL) Tel Commands can only use with DL Commande Hike LNSERT, DELETE and UPDATE only. © Commit © ROLL BACK 2 SAVE POINT. @) ConmaT :- Commit command is used 40 save a transaction fo the databace . Example :- Devete From Customers UINERE AGE = 25; Commit. b)- ROLL BAck :- Rollback COmmands }s used to UNdO transactions thet have not already heen saved 40 -the databace. SyMtaxi- ROLL Back sbbbbbbbooboidddddddddddececeeeoeee WLLL ddddedd ddd cee eeCCeee™ ¢). SAVEPOINT :- Tr ts used 40 voll the ¢ransauion back to g Certeln pant wjthout yolling hack entire pransaution - Sy ntox i- SAVEPOINT SavePoinT_.NAME Aqut compre (LINKEDIN): TELEG ENE Wares GHLLERY, 5: Data QuéAy LANGUAGE (DgL ) PQL is used 4o Fetch the data From tne databare - © elect 7? SELECT :- This 35 came as the projection operation OF velation al algebra. Jt }s used 40 seleck the attribute based on the conditton « Syntax! SELECT expressions FRom TABLES IIHERE Conditions ;

You might also like