Database Management STDUY

Database Management STDUY - Database Management I. SQL A....

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Database Management I. SQL A. Means of indicating what to do to the database B. Gives an indication of what should be in the result C. Basic statement is the Select statement 1. Three clauses 2. Select clause a. Keyword SELECT b. Followed by a list of columns to include in the result c. Use * or ALL if all columns in the table are wanted 3. From clause a. Keyword FROM b. List of tables where the information comes from c. More than one table implies a join is done 4. Where clause a. Keyword WHERE b. Followed by a condition to indicate which rows to include c. If all rows are wanted this can be omitted d. The join condition is given in the Where clause also D. Summary functions 1. Can find the average, sum, maximum, or minimum value of numeric columns 2. Use the function name with the column in parentheses 3. Can also find the number of non-null values in a column 4. If just want the number of rows use * instead of a column name 5. These will collapse all the rows into one 6. If you want averages, etc for groups add a clause to Select 7. GROUP BY followed by a list of column a. Will put all those that have the same value together b. Get an average, etc. for each different value c. Usually include the columns grouped by the identify the group the average is for E. Sorting 1. Can indicate the order the rows should be put in with SORTED BY 2. Keywords followed by a list of columns 3. Each column in the list can be followed by the keyword ASCENDING or DESCENDING to indicate the order wanted 4. If omitted ascending is assumed F. Union, Intersect, Minus 1. Can do the union, intersection, and difference
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
SQL does not combine tables, but select statements 3. Give the select statement, the appropriate keyword, and the select statement G. Subqueries 1. These are selections that allow the condition to test something in other tables 2. The subquery creates a set a. This is a list of values b. Always contained in parentheses c. The sub query must indicate only one column 3. Four operators a. IN 1) Give a field 2) Determines if the value in the field is contained in the set 3) There is also a NOT IN which is just the opposite b. ANY 1) Give a field, a relational operator, and the set 2) True if the relational operator is true for any value in the set 3) Also a NOT ANY c. ALL 1) Give a field, a relational operator, and the set 2) True if the relational operator is true fall all values in the set 3) Also a NOT ALL d. EXISTS 1) Only have the set 2) This is true if the resulting set is empty 3) ALSO a NOT EXISTS H. Other data manipulation 1. Need to be able to remove rows from a table, add rows to a table and modify values 2. INSERT a. Adds rows to a table b. Starts INSERT INTO followed by the name of the table c. Two possibilities 1) VALUES followed by a list of values in parentheses gives an entirely new row 2) Select statement selects rows from another table to add to this one 3. DELETE a. Removes selected rows from the table b. Starts DELETE FROM followed by the name of the table
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/30/2008 for the course ENG 101 taught by Professor Maisel during the Spring '00 term at Delaware Valley University .

Page1 / 9

Database Management STDUY - Database Management I. SQL A....

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online