Download as pdf
Download as pdf
You are on page 1of 6
a EE SAL Commands : © SAL basic commands on Database + Te. display/shew lists of database im ROOMS % Pea an YSN> stow DATAGASES 5 Q Th create Kew dodnbase in RDOMS ¢ fma- myam'> CREATE DATABASE School 5 Ta adotubase name @) Te open an existing database Aea- mipsel USE Scheal 5 Ae Te database, neo Hee accessible ¥ VEY OI To display show Mist of stored tables in Databose: 7—> School database ts Aus- mysql> USE School; ‘Usable now mysw)> SHOW TAOLES 5 A displaying an tables in database W To Remove | Delete twisting databae | pus— mysal > OROP DATABASE School + SQL— DDL ( Data Definihon Language) ~ Command + %O CREATE Command ¢ a Te crtake anew ravle Student (sro, s-rame, s_ class, Sosee, S2meTK , s_pes) CREATE TAOLE Student C svn inkeger , S-name varehar(20), s-class Inheger(2), 2 s-see chav Ct), s- mark inkeger C18), s-006 date) 5 CREATE TABLE ~ command ertakes structure of table Scanned with CamScanner * To create a table Employee Ce-1, NM, E-SAL, BDEPT, €- yop, €-008) yewilh- F-10 with NOT MULL ond primary Key cons hraiak E-Nm wife NOT NULL constrains and CREATE TABLE Employee oes C E-ID integer Not africa 20 Key, ELNM vavchev (30), Not NULLs E-SAL decimal, WN constraint E- DEPT varchar (10), E_rop date, E-dog date) 5 GD ALTER Command t HALTER command is used to-change/ modify frela/athritele, aad new — ” ~ delete old — ” sub command — APO, Moviny Table Student Cs_yor) 7 cHanae, DRop, Rename (2) Te ada/ include neco Pield/attrivute t ie Foren ran} i i MISS ALTER TABLE Student adding new freia— s-\oe te table Shedent AOD Csioe varchar (10> x mysvl> ALTER TABLE student AOD Cs- session ‘heB C0) defautt 2021 adding new freld os j ein deft vaue 2021 + atter running above fyo commands, the toble ai bet Student Cero, S-mame, s-class, S-See, ¢_ mark, g-006, s-loc, 5_ session) A Too neo Field/ attribute Scanned with CamScanner © Te _ modify - oF change daimtupe of filt= sname fram varchar (2) to vercherC#s) in table student, [avte R+ MopiF~ \— mysyl> ALTER TAGLE Shdent MOPIFY Cs-name vorehar(ée 5s Ce To vename_ a fieid/ecluum + change te name of field s-loe to S-“ty in Studen} table, ALTER + CHAN GE|—> mysql> ALTER TACLE Stydent CHANGE s-loe sucky versher Cte 5 t \ old Rae nome eeu of eemN gg calumnn . , hes (D To yemove/detete a field/ coduwm tovle + Te vemove/delete * m Aabl sto den! a rremove WE clown] field - 8~Se88°% from + t pore enr> mysvl > ALTER TABLE stvdent DROP Cs-session) 3 D DROP command ¢ ® remove] delete/ drop a table database, stdert from eurrant my syL> DROP TABLE Student 5 OY REWAME Cumand M-1% # Taname table name from Student te mysel> ALTER TABLE Shdent — : RENAME To Condidatese——— new *! le mame. old tele mame, Scanned with CamScanner * vename a dnble name: No MPEE> ALTER Train student TO Candidate 5 t t Josie nauat alias Date operations on Table COML- Command) ¢ ! © Taserk weeord/row inalde a table INSERT INTO Command = Student (s_roll, s-nome, | ae suclas, £-$4€, s-maru, $008) ™ySUL> INSERT INTO Student Csr 0, sarram , saclass, $506, +06) VALLES Cie, ‘Arnold, 1, °A!, 4, 128-2001) 3 Sat oR Me mMYsaL> INSERT INTO Sivdent VALUES (16, Arnold) 1, tA), 8a, 12-8 ~200)5 ide a tables ® Tosert movitiple recor as/vous INSERT INTO Command |> this port is ap tina) v myFUl> INSERT INTO Student G-relss-name, s-clats,s-see, S-mork, ¢—bos) VAWES C16, 'Amold 1, 6A), 84, 11-8-Le0!), CIE SDaviay, 11, 6B! aL, 1-6-2008), ina table: | Trsect data inte specific Pretayestow nt myset> INSERT INTO Student Cs voll, s name, Sm omg) VALWES CAs “Ankita Doo", 1973 T ae bot, dates msir ted Vato Fea aba singer bed ia oat ta porHeatey given Files eee Scanned with CamScanner ®s. SEIOb NOLL valve. inte parhenlar fiela/ column me, S-Class, SSE mys WSYLD INSERT INTO Student (s-7ell, s-n% 5 semarn, $-d08 Vawes C15, ‘David! 10,1, NULL, not) 5 uit value is rerked into s-marn and £-008 Student Kable ealumn in © Vedate esting dake/record in table: UPDATE +SET Command [> student Cs-rell, s-name, sclass, s- sec, s—7er%, 3-08 EL aly, sosession H See 2021 on tre session of each studeub to Student tnble— ra- MISULD VEDATE student cpaaredtlecerd = 20215 <—~ without eonditon studsat whoes voll mumber fs 19 SET s session te eek mark oo AF for mE Stvdeub tole, mysq b> UPOATE Student Pras SET 0 somerK = IS penbonler update, record in HERE s-rok = 85 “ ues 83 tuble” based on condition H change Student mark oo Fe ond 0OG 97 “‘\-oa-1ase/ for i student (Arnel? pos ISHED UPDATE Stuctent SET so mark =718, QOH © 1-08-1998! WWERE s-name = Amal) para updating mu rtiple date ww ~ revo ated on condition m® aad 20 marKs For \Ki sto heving cell wambur 10,20 and 30 jn Student teble — poe mos > UPDATE Shydent vpdate ty matnematier ser eo elation S-mark = S—-mark 420 WHERE sve zl and 2-7ell = 20 and S-7OIN= 3 Scanned with CamScanner © Kon eect F update mare ar NULL far tnt shedenly ashe SANG ESlon I he fersion 2021 SS OPOATE cent SET s-marg =NULL WHERE s_seaston= 202) 5 D® Remove Data Bem ‘Table ae * vemeve/ delete Yeeord /vew/ data from table ~ i I PELETE Commang |» Student (s-voll, s— name, £-Class, — S-See, S-marn,s_ 008, S-eity, 8-sesiton) 3-roll=10; © mysat> PeLETe Student where S-men <0 3 FROM Hes cede ut delebe the particular TeCoras (rows bostd on condition Truncate Teeords/rows rom toble + TRUNCATE TABLE Command be F vemove/ Ate all records / rows from table. Shy deat, "ISYLS TRUNCATE TAGLE t TRUNCATE command Ta-wsed ty dob at toe, ‘ yews from arable and ‘fre the space emahel antag toe 4nele, Student, Scanned with CamScanner

You might also like