SQL Notes.doc - SQL notes THE SELECT STATEMENT The SELECT statement is the workhorse of query processing the basic statement is:SELECT COLUMN(S FROM

SQL Notes.doc - SQL notes THE SELECT STATEMENT The SELECT...

This preview shows page 1 - 3 out of 5 pages.

SQL notes THE SELECT STATEMENT The SELECT statement is the workhorse of query processing the basic statement is:- SELECT COLUMN(S) FROM TABLENAME; This is the minimum amount of detail which must be entered for a SELECT statement to work. Try the following examples:- SELECT * FROM emp; Provides a listing of all the data (all columns) in the EMP table. SELECT ename FROM emp; Gives a list of all the employee names found in the emp table. SELECT dname, loc FROM dept; Gives department names and locations. SELECT job FROM emp; (with duplicates) Lists all the jobs in the emp table even if they appear more than once. SELECT DISTINCT job FROM emp; (without duplicates) List all the jobs in the EMP table eliminating duplicates. SELECT job, deptno FROM emp; (with duplicates) Lists the combination of jobs and departments for every row of the emp table. SELECT DISTINCT job, deptno FROM emp; (without duplicates) List all the combinations of job and department in the EMP table eliminating duplicates.
Image of page 1
SQL notes THE WHERE CLAUSE A WHERE clause causes a 'search' to be made and only those rows that meet the search condition are retrieved. A WHERE clause condition can use any of the following comparison operators:- = equal to SELECT * FROM emp WHERE ename = 'JONES'; (Again note that the data is case sensitive, this would not find Jones) != not equal to ^= not equal to <> not equal to SELECT * FROM emp WHERE ename != 'FORD'; > greater than
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 5 pages?

  • Spring '14

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors