Sei sulla pagina 1di 20

University of Houston Downtown

User Manual for SQL Report Development

USINGSQLDeveloperatUHD
SQL(StructuredQueryLanguage)allowsyoutostoreandretrievedatabaseinformation.AtUHD,Oracle SQLDeveloperisoneofthetoolsusedforSQLdatabasework. OracleSQLDeveloperisagraphicaltoolfordatabasedevelopment.WithSQLDeveloper,youcan browsedatabaseobjects,runSQLstatementsandSQLscripts,andeditanddebugPL/SQLstatements. Youcanalsorunanynumberofprovidedreports,aswellascreateandsaveyourown.SQLDeveloper enhancesproductivityandsimplifiesyourdatabasedevelopmenttasks.

First Time Users


FirsttimeuserswillneedtoaccessSQLPLUStoestablishtheirpasswords.Youmayusethistoolto changeyourpasswordaswell. ToaccessSQLPLUS: 1. LocatetheprogrambygoingtoAllPrograms>OracleOraClient11g_home1>Application Development>SQLPlus.

Updated May 16, 2012

2. 3. 4. 5. Youwillbetakentoascreenthatwillpromptyoutoenteryourusername. EnteryourUHDNetworkUsername@SBOXandOraclePassword.PressEnter. Youwillbenotifiedthatyourpasswordhasexpired.PressEnter. TypeaNewPassword.PressEnter.

6. RetypetheNewPassword.PressEnter. 7. YouwillbenotifiedthatyourpasswordhasbeenchangedandthatyouareconnectedtotheOracle Database.TypeexitandpressEntertocloseSQLPlus.

2 Updated May 16, 2012

To Change the Password: IfforanyreasonyouwouldliketochangeyourOraclepasswordinthefuture,youwillaccessSQLPlus todothisaswell. 1. 2. 3. 4. 5. 6. AccessSQLPlus. Youwillbetakentoascreenthatwillpromtyoutoenteryourusername. EnteryourUHDNetworkUsernameandOraclePassword.PressEnter. Typethewordpassword,withoutquotes. YouwillbepromptedtoenteryourOldPasswordandthentotypeandRetypetheNewPassword. TypeexitandpressEntertocloseSQLPlus.

Note:ChangingthepasswordinOracleDoesNotchangeyourUHDNetworkIDorpassword.

Updated May 16, 2012


Accessing the Oracle SQL Developer
1. LocatetheprogrambygoingtoAllPrograms>OracleOraClient11g_home1>Application Development>SQLDeveloper.

Updated May 16, 2012

2. ThefirsttimethatyouaccessSQLDeveloper,youwillneedtoSavethedatabaseconnection: a. RightClickConnections.

b. SelectNewConnection.

Updated May 16, 2012

c. Enterthefollowing: ConnectionName:SBOX Username:UHDNetworkID Password:OraclePassword ConnectionType:TNS NetworkAlias:SBOX d. ClickSave. e. ClickConnect.

Updated May 16, 2012

Define Database Tables


Toconnecttothedatabase: 1. DoubleclickConnections.EnteryourOraclepasswordandthenclickOK.

DoubleClick

EnterPassword

ToviewthelistoftablesintheUHDSchema: 1. DoubleclickSBOX. 2. SelectOtherUsers.

DoubleClick

Updated May 16, 2012

3. SelectUHDandthenTables.

4. Youwillseealistoftables.

Updated May 16, 2012

UHDtables: WADMABCAdmissiondetailsbystudent. WABCXYZGeneralstudent/registrationdetails.IthasbothcurrentandReportingDayInformation (WABCXYZ_D12C,O). WBICRSECoursedetails

Toviewthecolumns: 1. Doubleclickatablename.

ToQueryadatabase: Syntax: SELECTcolumnname1,columnname2 FROMtablename WHEREconditions GROUPBY HAVING ORDERBY

Updated May 16, 2012

Executing SQL
BelowarehelpfultoolsandbuttonsthatwillhelpexecuteSQLqueriesinOracleDeveloper. WritesimpleSQL:

ExecutetheSQL:

10

Updated May 16, 2012

ErasetheSQL:

StoptheSQL:

11

Updated May 16, 2012

ViewtheOutput: Theoutputwillappearatthebottomofthewindow.YoumaywanttoexpandtheResultssection bydraggingthetopbarupwardtoviewalloftheresults.

12

Updated May 16, 2012

Sorttheoutputbycolumn:

ExporttheOutput:

Note:Forlargefiles,selectCSVastheexportfiletype.CSVfilescanbeopenedandreadbyMSExcel.

13

Updated May 16, 2012

OpennewSQLFile:

SavetheSQLFile:


14 Updated May 16, 2012

OpenthesavedSQLFile:

ViewSQLHistory:

DoubleClick

15

Updated May 16, 2012

Examples
TrytoexecutetheexamplequeriesbelowusingOracleDeveloper.Youwillfindthesolutionsto Examples#1#3onthefollowingpages. Question#1ListStudentBannerID,StudentFirstname,StudentLastnameofalltheundergraduate studentswhohaveadmittedinFall2011(201210)andattendedHighSchoolH01059OutofTexas HighSchool.

Question#2FindthenumberofstudentswhohavetheattributecodeTSIC(TSIContract)inthe term201210.

Question#3ListthecourseswhichareofferedinthecollegeHSfortheterm201210.

16

Updated May 16, 2012

Examples Answers
Answer#1:
SELECTdistinctwadmabc_ban_idas"BannerId", wadmabc_lnameas"LastName", wadmabc_fnameas"FirstName" FROMUHD.wadmabc WHEREwadmabc_term_code='201210' ANDwadmabc_stu_levl='00' ANDwadmabc_high_sch_infoLIKE'%H01059%';

17

Updated May 16, 2012

Answer#2: SELECTcount(distinctwabcxyz_pidm)fromuhd.wabcxyz wherewabcxyz_d12=C andwabcxyz_term_code=201210 andwabcxyz_atts_code_mlike%TSIC%;

18

Updated May 16, 2012

Answerto#3: SELECT*fromuhd.wbicrse wherewcvcrse_term_code='201210' andwcvcrse_d12='C' andwcvcrse_coll_code='HS';

19

Updated May 16, 2012

Potrebbero piacerti anche