12
STARTING SQL CODE in MSSQL Server RAYMOND S. BERMUDEZ Instructor, College of Computer Studies - MSEUF LESS O N 3

4_intro to SQL code

Embed Size (px)

Citation preview

Page 1: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 1/12

STARTING SQL

CODE in MSSQLServer

RAYMOND S. BERMUDEZ

Instructor, College of Computer Studies - MSEUF

LESSON 3

Page 2: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 2/12

BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

()&t is S*%+

SQL is & l&ngu&ge t)&t is used in tom&nipul&te rel&tion&l d&t&&ses.

%ie *BE, S*% proides users /it) t)ec&p&ilit' of 0uer'ing & rel&tion&l

d&t&&se.1o/eer, in S*%, 'ou must enter

commands to ot&in t)e desired results,r&t)er t)&n completing &n on-screen form

&s 'ou do in Access &nd *BE.S*% uses comm&nds to creae a!"es#

$%dae a!"es# and rerieve daa &roma!"es.

 2)e comm&nds t)&t &re used to retrieed

Page 3: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 3/12

BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

()&t is S*%+

SQL /&s deeloped under t)e n&meSE*UE% &t t)e IBM S&n 3ose rese&rc)f&cilities &s t)e d&t& m&nipul&tion

l&ngu&ge for IBMs protot'perel&tion&l "BMS, S(sem R, in t)emid)*+,-s.

In *+-, it /&s ren&med S*% 4ut

still pronounced &s 5se0uel67&lt)oug) t)e e0u&ll' popul&rpronunci&tion of 5S-*-%6 to &oidconfusion /it) &n unrel&ted

)&rd/&re product c&lled SE*UE%.

Page 4: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 4/12

BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

()&t is S*%+

SQL is used &s t)e d&t&m&nipul&tion l&ngu&ge for IBM8scurrent production o9erings-S*%"S

&nd "B;- in t)e rel&tion&l "BMS&ren&.

Most rel&tion&l "BMSs use & ersion

of S*% &s d&t& m&nipul&tionl&ngu&ge.

S*% is t)e st&nd&rd l&ngu&ge for

Page 5: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 5/12

BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

()&t is S*%+

Daa De/niion Lan0$a0e 1DDL2

used to de<ne, c)&nge, or dropd&t&&se o=ects

Daa Mani%$"aion Lan0$a0e 1DML2used to re&d &nd modif' d&t&

Daa Conro" Lan0$a0e 1DCL2

used to gr&nt &nd reoe &ut)ori>&tions

Transacion Conro" Lan0$a0e 1TCL2

/it) st&tements suc) &s CMMI2,

R%%BAC?, SA@EI!2 /)ic) group "M%st&tements to et)er to e eecuted &s &

Page 6: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 6/12

BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

Introduction to Code

 2o open t)e editor:n t)e m&in menu, 'ou c&n clic 3i"e

)4 Ne5 )4 Q$er( 6i7 C$rren

Connecionn t)e St&nd&rd tool&r, clic t)e

!e/ *uer' utton

In t)e =ect Eplorer, rig)t-clic t)e

n&me of t)e serer &nd clic !e/*uer'

 2)is /ould cre&te & ne/ /indo/ &ndposition it on t)e rig)t side of t)e

interf&ce.

Page 7: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 7/12BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

S&ing t)e Code

()et)er 'ou )&e &lre&d' /rittencode or not, 'ou c&n s&e t)edocument of t)e code editor &t &n'

time. 2o s&e it: You c&n press Ctrl S

n t)e m&in menu, 'ou c&n clicFile -D S&e S*%*uer'.s0l...

n t)e St&nd&rd tool&r, 'ou c&nclic t)e S&e utton

Page 8: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 8/12BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

Page 9: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 9/12BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

Eecuting & St&tement

After /riting & st&tement, 'ou c&neecute it, eit)er to m&e it &ctie orsimpl' to test it. 2o eecute &

st&tement:ress F

n t)e m&in menu, clic *uer' -DEecute

n t)e S*% Editor tool&r, clic t)eEecute utton

Rig)t-clic some/)ere in t)e code

editor &nd clic Eecute

Page 10: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 10/12BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

Eecuting & St&tement

()en 'ou eecute code, code editorecomes diided into t/o )ori>ont&lsections:

Page 11: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 11/12BY: Mr. RAYM!" S. BERMU"E#, - Instructor, College of Computer Studies, MSEUF $ %ucen& Cit'

Eecuting & St&tement

Also, /)en 'oueecute code,t)e interpreter

/ould <rst&n&l'>e it. Ift)ere is &nerror, it /ould

displ&' one ormore lines oferror tet in itsottom section.

1ere is &n

Page 12: 4_intro to SQL code

7/25/2019 4_intro to SQL code

http://slidepdf.com/reader/full/4intro-to-sql-code 12/12

STARTING SQL

CODE in MSSQLServer

RAYMOND S. BERMUDEZ

Instructor, College of Computer Studies - MSEUF

LESSON 3