How To Create A SQL Statement - UCSD Blink

Toggle navigation search-icon Search Faculty/Staff Search Blink
  • Budget & Finance arrow
    • BI & Financial Reporting
    • Buy & Pay
    • Finance
    • Logistics
    • Finance Administration Resources
    • Travel & Entertainment
  • Facilities & Services  arrow
    • Campus Planning Site
    • Facilities Management
    • Real Estate
    • Triton Print & Digital Media
    • Transportation Services Site
  • Faculty & Instruction  arrow
    • Faculty
    • Student/ Class Info
    • Student Operational Reporting
    • Instruction Tools
  • Human Resources  arrow
    • About Us
    • Benefits
    • Ecotime
    • Employee Center
    • UCPath
    • UC Learning Center
  • IT Services  arrow
    • Get Help
    • Technology Topics
    • Browse Service Portal
    • Connect from Home
    • Careers
    • About Us
  • Research & Innovation  arrow
    • About Us
    • Organized Research Units (ORUs)
    • Research Affairs
    • Sponsored Research Administration
  • Health & Safety  arrow
    • Environment, Health & Safety
    • Police Department
    • Safe Campus
  • Blink Resources   arrow
    • About Blink
    • Campus Directory
    • Departments in Blink
    • List of Tools
  • Budget & Finance
    • BI & Financial Reporting
    • Buy & Pay
    • Finance
    • Logistics
    • Finance Administration Resources
    • Travel & Entertainment
  • Facilities & Services
    • Campus Planning Site
    • Facilities Management
    • Real Estate
    • Triton Print & Digital Media
    • Transportation Services Site
  • Faculty & Instruction
    • Faculty
    • Student/ Class Info
    • Student Operational Reporting
    • Instruction Tools
  • Human Resources
    • About Us
    • Benefits
    • Ecotime
    • Employee Center
    • UCPath
    • UC Learning Center
  • IT Services
    • Get Help
    • Technology Topics
    • Browse Service Portal
    • Connect from Home
    • Careers
    • About Us
  • Research & Innovation
    • About Us
    • Organized Research Units (ORUs)
    • Research Affairs
    • Sponsored Research Administration
  • Health & Safety
    • Environment, Health & Safety
    • Police Department
    • Safe Campus
  • Blink Resources
    • About Blink
    • Campus Directory
    • Departments in Blink
    • List of Tools
SearchThis SiteAll UCSD SitesFaculty/StaffSearch Term Toggle navigation TOOLS
  • Personal arrow
    • Compensation Calculator
    • Educational Benefits
    • Job Bulletin
    • My Directory
    • Ecotime Campus
    • My Training
    • Performance Appraisal
    • UC Learning Center
    • UCnet
    • UCPath
    • UCRAYS
  • Business arrow
    • Services & Support
    • Concur Travel & Expense
    • Oracle Financials Cloud
    • AP On-Line
    • Business Analytics Hub
    • Campus Space Management (Tririga)
    • CAMS
    • Ecotime Campus
    • E-Markets
    • EmployeeLink
    • FinancialLink
    • HireOnline
    • JDOnline
    • Logistics Portal
    • MyMobileBill
    • Onboarding
    • Oracle Procurement
    • PADUA
    • PaymentWorks
    • Performance Appraisals
    • Recharge Plus
    • SPARCM (login required)
    • STAR
    • Title & Pay Look-up
    • Tracker I-9 Complete
    • UCPath
    • VPN
  • Instruction arrow
    • ASSIST
    • Canvas
    • Class lists
    • Classroom details
    • Co-Curricular Record
    • eGrades
    • Enrollment/waitlists
    • Find a student
    • General Catalog
    • Majors list
    • Minors list
    • Queries
    • Schedule of Classes
    • Student Directory
    • Term Audit
  • Research arrow
    • Services & Support
    • Faculty Expertise
    • Kuali Research
    • MyEffort
    • My Research Safety
    • Research Development
    • Training Resources
  • Resources For: arrow
    • Finance Admin
    • Research Admin
  • All Tools
  • TOOLS:
  • Personal
    • Compensation Calculator
    • Concur Travel & Expense
    • Educational Benefits
    • Job Bulletin
    • My Directory
    • Ecotime Campus
    • My Training
    • Performance Appraisal
    • UC Learning Center
    • UCnet
    • UCPath
    • UCRAYS
  • Business
    • Services & Support
    • Concur Travel & Expense
    • Oracle Financials Cloud
    • AP On-Line
    • Business Analytics Hub (BAH)
    • Campus Space Management (Tririga)
    • CAMS
    • Ecotime Campus
    • E-Markets
    • EmployeeLink
    • FinancialLink
    • HireOnline
    • JDOnline
    • Logistics Portal
    • MyMobileBill
    • Onboarding
    • PADUA
    • PaymentWorks
    • Performance Appraisals
    • Recharge Plus
    • SPARCM (login required)
    • STAR
    • Title & Pay Look-up
    • Tracker I-9 Complete
    • UCPath
    • VPN
  • Instruction
    • ASSIST
    • Canvas
    • Class lists
    • Classroom details
    • Co-Curricular Record
    • eGrades
    • Enrollment/waitlists
    • Find a student
    • General Catalog
    • Majors list
    • Minors list
    • Queries
    • Schedule of Classes
    • Student Directory
    • Term Audit
  • Research
    • Services & Support
    • Faculty Expertise
    • Kuali Research
    • MyEffort
    • My Research Safety
    • Research Development
    • Training Resources
  • Resources for:
    • Finance Admin
    • Research Admin
  • All
    Faculty & Staff
  1. Home
  2. Technology
  3. IT Help
  4. Queries
  5. Creating an SQL Statement
How to Create a SQL Statement Last Updated: October 13, 2022 1:43:00 PM PDT Give feedback

Use this guide to review how to create a select SQL statement to use in the SQL Executer.

As you review the statements and clauses below, note that brackets identify optional information.Include a bracketed item if you want to select more specific data.

  • For helpful hints and problem solutions, SQL Review and Troubleshooting.

Note: If you don't know the SQL programming language, you can use QueryLink by clicking the Queries button in FinancialLink, EmployeeLink, Student/ Class Info tools, and DataLink.

1. Start your query with the select statement.

  • select [all | distinct] A select statement queries the database and retrieves selected data that match the specified criteria.

2. Add field names you want to display.

  • field1 [,field2, 3, 4, etc.] The field name specifies the particular fields that contain the data.

    Note: You can find field and data table names in the Data Models section of DataLink.

3. Add your statement clause(s) or selection criteria.

  • Required:
    • from table1[, table2] The from clause specifies the table(s) that contain the data.
    Optional:
  • where conditions The where clause specifies the selection condition(s) by which data is retrieved.
  • order by [column-list] The order by clause specifies the ordering or sorting of rows.
  • group by [column-list] The group by clause groups the resulting rows in sets.
  • having conditions The having clause allows a search condition and is used with the group by clause.

4. Review your select statement.

  • Here's a sample statement:

    select [all | distinct] field1[,field2] from table1[,table2] [where conditions] [group by field-list] [having conditions] [order by field-list]

  • The example below shows SQL being used in the SQL Executer to produce a phone list of all ACT staff by last name.
  • The list will show last names, first names, phone extensions, and e-mail addresses.

Sample statement screenshot

Contact the Data Warehouse team or enroll in a SQL training class.

Queries

  • Access
  • Creating an SQL Statement
    • Troubleshooting
    • Using SQL Executer
    • QueryLink & Excel PivotTables
  • Data Warehouse

Departments

IT Services

Tag » Code Scripts And Database Queries