Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting started with SQL Queries and Programming Jeremy Brinkman Assistant VP for Information Technology University of Northwestern Ohio.

Similar presentations


Presentation on theme: "Getting started with SQL Queries and Programming Jeremy Brinkman Assistant VP for Information Technology University of Northwestern Ohio."— Presentation transcript:

1 Getting started with SQL Queries and Programming Jeremy Brinkman Assistant VP for Information Technology University of Northwestern Ohio

2 Private, Non-profit Institution Founded in 1920 4600+ students from all 50 states and 24 foreign countries Five Colleges: College of Applied Technologies, College of Business, College of Occupational Professions, College of Health Professions, Graduate College University of Northwestern Ohio www.unoh.edu

3 The SQL developer’s toolbox Locating data in Colleague SQL query fundamentals Presentation Overview

4 The SQL Developer’s Toolbox

5 SQL Server Management Studio The SQL Developer’s Toolbox

6 Colleague Screens – RDEL – RDEP – RFEI – RDSF The SQL Developer’s Toolbox

7 Colleague Screens Continued – EOFM The SQL Developer’s Toolbox

8 Simple but effective: browse the data SELECT TOP 10 * FROM TABLE The SQL Developer’s Toolbox

9 Other useful tools – SQL Server Profiler – Colleague Studio – Red-gate SQL Prompt The SQL Developer’s Toolbox

10 Locating Data in Colleague

11 Locating Data on Colleague Screens Field help Form/process help F1

12 Locating Data on Colleague Screens

13 Lookup the field on RDEL to get the file name.

14 Locating Data on Colleague Screens Match the file name from RDEL to the SQL table

15 Locating Data on Colleague Screens Interpreting RDEL Replace the “.” with “_” to derive the SQL table name from the UniData file name. Data Fields (D) – data can be found inside the table listed in the File Name field. List Fields (L) – Data can be found in the _LS table version of the table in the File Name field. PERSON_LS is one example. Associated Fields (A) – Data can be found in a SQL table named for the association listed on RDEL. X Pointer and Q Pointer Fields – Related data can be found in the Secondary Pointer/File. For X Pointer fields, the pointer exists in the SQL table itself. For Q Pointer fields, the pointer exists in the _LS table.

16 Locating Data on Colleague Screens Q Pointer example:

17 Locating Data on Colleague Screens Q Pointer example in SQL Server:

18 Locating Data on Colleague Screens Associated field example:

19 Locating Data on Colleague Screens Associated field example in SQL Server:

20 Locating Data on Colleague Screens Q Pointer + Association example:

21 Locating Data on Colleague Screens Q Pointer + Association in SQL:

22 Locating Data on Colleague Screens A few more tips: The POS field is used to store the position of data in multivalued fields or associations. “VAR” fields found on Colleague forms do not represent actual fields in the SQL database. File Suites are often difficult to interpret. In general, when you see “ACYR” in a file, you can replace it with the file suite year.

23 SQL Query Fundamentals

24 SELECT FROM WHERE ORDER BY Elements of a basic SQL Query

25 SELECT PERSON.FIRST_NAME, PERSON.LAST_NAME FROM PERSON WHERE PERSON.LAST_NAME = ‘Flintstone’ ORDER BY PERSON.FIRST_NAME SQL Query Example #1

26 Coding Tip: Always prefix your field names with a table name or alias. Coding Tip

27 Using a Computed Column SQL Query Example #2 SELECT PERSON.FIRST_NAME, PERSON.LAST_NAME, dbo.AGE(PERSON.ID) FROM PERSON WHERE PERSON.LAST_NAME = 'Flintstone' ORDER BY PERSON.FIRST_NAME

28 SELECT FROM INNER JOIN ON = WHERE ORDER BY Let’s Join Another Table

29 SELECT PERSON.FIRST_NAME, PERSON.LAST_NAME, PERSON_LS.POS, PERSON_LS.PER_ETHNICS FROM PERSON INNER JOIN PERSON_LS ON PERSON_LS.ID = PERSON.ID WHERE PERSON.LAST_NAME = ‘Flintstone’ ORDER BY PERSON.FIRST_NAME SQL Query Example #3

30 Coding Tip: Keep code clean by using proper indentation. Coding Tip

31 Most Common Join Types INNER JOIN – Include only records where the join field(s) matches in the left and right table. LEFT OUTER JOIN – Include all records from the left table and only those in the right table that match the join field(s)

32 SQL Query Example #4 List all addresses for a person SELECT PERSON.FIRST_NAME, PERSON.LAST_NAME, ADDRESS_LS.ADDRESS_LINES, ADDRESS.CITY, ADDRESS.STATE, ADDRESS.ZIP FROM PERSON INNER JOIN PSEASON ON PERSON.ID = PSEASON.ID INNER JOIN ADDRESS ON PSEASON.PERSON_ADDRESSES = ADDRESS.ADDRESS_ID INNER JOIN ADDRESS_LS ON ADDRESS.ADDRESS_ID = ADDRESS_LS.ADDRESS_ID AND ADDRESS_LS.POS = 1 WHERE PERSON.LAST_NAME = 'Flintstone'

33 Questions?

34 Contact Information Jeremy Brinkman Assistant VP for Information Technology University of Northwestern Ohio jbrinkman@unoh.edu


Download ppt "Getting started with SQL Queries and Programming Jeremy Brinkman Assistant VP for Information Technology University of Northwestern Ohio."

Similar presentations


Ads by Google