ORACLE SQL REFERENCE GUIDE July 2004

Size: px
Start display at page:

Download "ORACLE SQL REFERENCE GUIDE July 2004"

Transcription

1 ORACLE SQL REFERENCE GUIDE July 2004 Created by Larry Haug The Guthrie Center Spring Branch ISD Hammerly Boulevard Houston, TX Send comments and/or suggestions for improvement to

2 TABLE OF CONTENTS Section 1 Naming Rules... Page 3 Section 2 Data Types Page 3 (CHAR, VARCHAR2, NUMBER, DATE, SYSDATE, TIMESTAMP, WITH LOCAL TIME ZONE, INTERVAL YEAR TO MONTH, INTERVAL DAY TO SECOND, BLOB, CLOB) Section 3 Expressions.. Page 4 Section 4 Oracle SQL Statement Format.. Page 4 (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, ASC, DESC) Section 5 Data Definition language (DDL).... Page 5 (CREATE TABLE, ALTER TABLE, ADD, DROP COLUMN, DELETE FROM, MODIFY, RENAME, DROP TABLE, SET UNUSED, DROP UNUSED COLUMNS, TRUNCATE TABLE, COMMENT ON) Section 6 Aliases... Page 6 (SELECT AS) Section 7 Views..... Page 6 (CREATE VIEW, DROP VIEW, SELECT ROWNUM AS) Section 8 Sequences.... Page 7 CREATE SEQUENCE, ALTER SEQUENCE, DROP SEQUENCE) Section 9 Indexes.. Page 8 CREATE INDEX, DROP INDEX) Section 10 Synonyms..... Page 8 (CREATE SYNONYM, DROP SYNONYM) Section 11 Constraints..... Page 9 (ADD CONSTRAINT, DROP CONSTRAINT, MODIFY CONSTRAINT, DISABLE CONSTRAINT, ENABLE CONSTRAINT) Section 12 Data Manipulation Language (DML). Page 10 (INSERT INTO, UPDATE, MERGE INTO) Section 13 Data Retrieval Page 11 (DESCRIBE, SELECT, DISTINCT) Section 14 Case Manipulation Functions.... Page 11 (UPPER, LOWER, INITCAP) Section 15 Character Manipulation Functions.... Page 11 (LIKE, CONCAT, SUBSTR, LENGTH, INSTR, LPAD, RPAD, TRIM, REPLACE, TO_NUMBER, TO_DATE) Section 16 Number Manipulation Functions Page 13 (ROUND, TRUNC, MOD, TO_CHAR, POWER) Section 17 Date Manipulation Functions..... Page 13 (MONTHS_BETWEEN, NEXT_DAY, LAST_DAY, ADD_MONTHS, TO_CHAR) Section 18 Null Value Functions... Page 15 (NVL, NVL2, NULLIF, COALESCE) Section 19 Conditional Functions..... Page 15 (CASE, DECODE) Section 20 Joins... Page 15 Section 21 Oracle Joins.. Page 16 (Equijoin, Cartesian Product Join, Nonequijoin, Outer Join, Self Join) Section 22 ANSI Joins.... Page 16 (NATURAL JOIN, CROSS JOIN, JOIN USING, JOIN ON, OUTER JOIN) Section 23 Group Functions Page 18 (AVG, SUM, STDDEV, VARIANCE, COUNT, MAX, MIN, GROUP BY, HAVING) Section 24 Subqueries Page 18 (IN, ANY, ALL) Section 25 Data Dictionary. Page 19 Section 26 Controlling User Access... Page 20 (CREATE ROLE, GRANT, WITH GRANT OPTION, PUBLIC,REVOKE) Page 2of 21

3 1. NAMING RULES The following naming rules apply to table names and column names: - Must begin with a letter - Must be 1 to 30 characters long - Must contain ONLY A - Z, a - z, 0-9, _ (underscore), $, and # - Must not duplicate the name of another object owned by the same user - Must not be an Oracle Server reserved word 2. DATA TYPES The CHAR data type specifies a fixed-length character string, including numbers, dashes and special characters. The string length is normally supplied in bytes but can be supplied in character columns. Strings are enclosed in single quotes. CHAR(n) CHAR(n CHAR) The VARCHAR2 data type specifies a variable-length character string, including numbers, special characters and dashes. Maximum string length is normally supplied in bytes but can be supplied in character columns. VARCHAR 2(n) VARCHAR2(n CHAR) The NUMBER data type stores zero as well as positive and negative fixed numbers. No dashes, text, or other nonnumeric data are allowed. Currency is stored as a number data type. Specify an integer using the following form: NUMBER(p) Specify a fixed-point number using the following form: NUMBER(p,s) where: p is the precision, or the total number of digits. Oracle guarantees the portability of numbers with precision of up to 38 digits. s is the scale, or the number of digits to the right of the decimal point. The scale can range from -84 to 127. If the scale is negative, then the actual data is rounded to the specified number of places to the left of the decimal point. For example, a specification of (10,-2) means to round to hundreds. The DATE data type stores date and time information. Oracle stores dates as numbers and by default DATE information is displayed as DD-MON-YY (for example, 19-JUN-04). The ANSI date literal contains no time portion, and must be specified in exactly this format ('YYYY-MM-DD'). The computer date can be accessed with the SYSDATE function. DATE ' ' Time can be added with the TIMESTAMP function. TIMESTAMP ' :26:50.124' TIMESTAMP ' :26:50.124' TIMESTAMP ' :26: WITH LOCAL TIME ZONE TIMESTAMP ' :26: [With Time Zone] TIMESTAMP ' :00:00-8:00' TIMESTAMP ' :00:00 US/Pacific' TIMESTAMP ' :00:00 US/Pacific PDT' The INTERVAL YEAR TO MONTH data type stores a period of time using the YEAR and MONTH datetime fields. This data type is useful for representing the precise difference between two datetime values. INTERVAL YEAR [(<year precision>)] TO MONTH where year precision is the number of digits in the YEAR datetime field. The default value of year precision is 2. Page 3of 21

4 The INTERVAL DAY TO SECOND data type stores a period of time in terms of days, hours, minutes, and seconds. This data type is useful for representing the difference between two datetime values when only the year and month values are significant. INTERVAL DAY [(<day precision>)] TO SECOND [(<fractional seconds precision>)] where day precision is the number of digits in the DAY datetime field. Accepted values are 0 to 9. The default is 2. Fractional seconds precision is the number of digits in the fractional part of the SECOND datetime field. Accepted values are 0 to 9. The default is 6. The BLOB data type stores unstructured binary large objects. BLOB objects can be thought of as bitstreams with no character set semantics. BLOB objects can store up to (4 gigabytes-1) * (database block size) of binary data. The CLOB data type stores single-byte and multi-byte character data. 3. EXPRESSIONS The order of evaluating expressions is as depicted in the table below. When evaluating parenthetical expressions, the innermost expression is evaluated first, then proceeding towards the outermost expression. AND both conditions must be true OR one condition must be true NOT returns rows that don t satisfy a condition 4. ORACLE SQL STATEMENT FORMAT 1 Arithemitic *, /, +, - 2 Concatenation 3 Comparison =, <, <=, >, >=, <> 4 IS (NOT) NULL, LIKE, (NOT) IN 5 (NOT) BETWEEN 6 NOT 7 AND 8 OR SQL statements for data retrieval are of the format (Students Fail When Gorillas Hide Oranges): SELECT <column name> FROM <table name> WHERE <condition> GROUP BY <condition> HAVING <condition> ORDER BY <condition> where SELECT clause - selects from the reduced data set the columns requested FROM clause - locates the table that contains the data WHERE clause - restricts the rows to be returned GROUP BY clause - enables aggregate data to be applied to groups of column values. HAVING clause - restricts the rows to be returned for aggregate data ORDER BY clause - orders the results set. Default is ASCending. Use DESC for descending. Numeric values are displayed lowest to highest. Date values are displayed with the earliest date first. Character values are displayed in alphabetical order. Null values are displayed last in ascending order sorts and first in descending order sorts. SQL statements are not usually case sensitive and can be entered on one or many lines. Keywords (SELECT, FROM, etc.) are typically entered in uppercase and cannot be abbreviated or split across lines. Table and column names are typically entered in lowercase. Page 4of 21

5 5. DATA DEFINITION LANGUAGE (DDL) The CREATE command can be used to create a table, view, sequence, index, or synonym. To create a table, use the CREATE TABLE command. A column in a table can be given a DEFAULT value. This option prevents null values from entering the columns if a row is inserted without a specified value for the column. Using default values also allows the user to control where and when the default value should be applied. The default value can be a literal value, an expression, or a SQL function, such as SYSDATE and USER, but the value cannot be the name of another column or a pseudocolumn, such as NEXTVAL or CURRVAL. The default expression must match the data type of the column. A second method for creating a table is to apply the AS subquery clause, which both creates the table and inserts rows returned from the subquery. CREATE TABLE <table name> (<column 1 name> <column 1 data type [DEFAULT <value or expression>]> [CONSTRAINT] [DISABLE] <constraint>, <column n name> <column n data type>) or CREATE TABLE <table name> AS SELECT <column 1>, <column 2>, <column n> FROM <table> To add a new column to a table or drop a column, you would use the ALTER TABLE command. ALTER TABLE <table> ADD (<new column name> <data type>) DROP COLUMN <column name> To delete a row from a table, use the DELETE FROM command. You cannot delete a row that contains a primary key that is used as a foreign key in another table. All rows will be deleted if the WHERE clause is omitted. DELETE FROM <table name> WHERE <condition for row select> To modify a column, you would use the MODIFY command. You can increase the width or precision of a numeric or character column. You can decrease the width of a column only if the column contains only null values or if the table has no rows. You can change the data type only if the column contains null values. You can convert a CHAR column to the VARCHAR2 data type or convert a VARCHAR2 column to the CHAR data type only if the column contains null values or if you do not change the size. A change to the default value of a column affects only subsequent insertions to the table. ALTER TABLE <table> MODIFY (<column 1> <data type> [DEFAULT <value or expression>], <column n> <data type>) To rename a table, you would use the RENAME command. RENAME <table name> TO <new name> To delete a table, you would use the DROP TABLE command. DROP TABLE <table> The SET UNUSED option marks one or more columns as unused so they can be dropped when the demand on system resources is lower. The columns are physically still in the database, they simply can no longer be accessed. Once columns are SET UNUSED, a SELECT * query will not retrieve data from the columns. Also, if a DESCRIBE statement is issued on the table, the columns marked SET UNUSED will not be displayed. In fact, you could add a new column to the database with the same name as the unused column. The UNUSED columns are there, but invisible! ALTER TABLE <table> SET UNUSED (<column>) DROP UNUSED COLUMNS removes all columns currently marked as unused. You use this statement when you want to reclaim the extra disk space from unused columns in a table. ALTER TABLE <table> DROP UNUSED COLUMNS Use the TRUNCATE TABLE command to remove all rows from a table and to release the storage space used by that table. TRUNCATE TABLE <table> Page 5of 21

6 You can add a comment of up to 2,000 bytes about a column, table or view by using the COMMENT ON statement. The comment is stored in the data dictionary and can be viewed in one of the data dictionary views (ALL_COL_COMMENTS, USER_COL_COMMENTS, ALL_TAB_COMMENTS, USER_TAB_COMMENTS) in the COMMENTS column: COMMENT ON TABLE <table> COLUMN <table.column> IS 'place your comment here 6. ALIASES Working with lengthy column and table names can be cumbersome. Fortunately, there is a way to shorten the syntax using aliases. Table aliases precede the column name. However, if a table alias is used in the FROM clause, then that table alias MUST be substituted for the table name throughout the SELECT statement. To distinguish columns that have identical names but reside in different tables use column aliases. Column aliases containing more than one word must be enclosed in double quotes. When there are no shared column names between two tables, there is no need to add the table name to it. SELECT <column in table 1> AS <alias>, <column in table 2> AS <column alias> or SELECT <table alias>.<column> FROM <table> <table alias> 7. VIEWS A VIEW, like a table, is a database object. However, views are not real" tables. They are logical representations of existing tables or of another view. Views contain no data of their own. They function as a window through which data from tables can be viewed or changed. The tables on which a view is based are called base tables. The view is a query stored as a SELECT statement in the data dictionary. Views restrict access to the data because the view can display selective columns from the table. Views can be used to reduce the complexity of executing queries based on more complicated SELECT statements. For example, the creator of the view can construct join statements that retrieve data from multiple tables. The user of the view neither sees the underlying code nor how to create it. The user, through the view, interacts with the database using simple queries. Views can be used to retrieve data from several tables providing data independence for users. Users can view the same data in different ways. Views provide groups of users access to data according to their particular permissions or criteria. There are two classifications for views: simple and complex. Simple views allow DML operations INSERT, UPDATE and DELETE through the view. Guidelines for creating a view include: The subquery that defines the view can contain complex SELECT syntax. The subquery that defines the view cannot contain an ORDER BY clause. The ORDER BY clause is specified when you retrieve data from the view. You can use the OR REPLACE option to change the definition of the view without having to drop it or re-grant object privileges previously granted on it. Aliases can be used for the column names in the subquery. You cannot remove a row from an underlying base table, modify data or add data through a view if the view contains group functions, a GROUP BY clause, the DISTINCT keyword or the pseudocolumn ROWNUM keyword (a number value given to each row in the result set). You cannot modify data through a view if the view contains columns defined by expressions. You cannot add data through a view if the view contains columns defined by expressions or NOT NULL columns in the base tables that are not selected by the view. NOT NULL means that the base columns must have a value. The user of a view will not see all the columns in the table and wouldn't know which columns in the base tables must have a value. Adding a new row must include data for all the NOT NULL columns for that row. To create a SIMPLE VIEW embed a subquery within the CREATE VIEW statement. CREATE [OR REPLACE] [FORCE] [NO FORCE] VIEW <view name> AS <subquery> [[WITH CHECK OPTION] [CONSTRAINT <constraint name>]] [WITH READ ONLY] where OR REPLACE re-creates the view if it already exists. FORCE creates the view regardless of whether or not the base tables exist. NO FORCE creates the view only if the base table exists (default). subquery is a complete SELECT statement (you can use aliases for the columns in the SELECT list). The subquery can contain complex SELECT syntax. WITH CHECK OPTION specifies that only rows accessible to the view can be inserted or updated. WITH READ ONLY ensures that no DML operations can be performed on this view. Page 6of 21

7 COMPLEX VIEWS are views that can contain joins and group functions. CREATE VIEW <view name> (<column 1>, <column 2>, <column n>) AS SELECT <table 1>.<column 1>, <table 1>.<column 2>, <table 2>.<column 1>, <table 2>.<column 2> FROM <table 1>, <table 2> WHERE <table 1>.<column 3> = <table 2>.<column 3> or CREATE VIEW <view name> (<column 1>, <column 2>, <column n>) AS SELECT <table 1>.<column 1>, <table 1>.<column 2>, <table 2>.<column 1>, <table 2>.<column 2> FROM <table 1>, <table 2> WHERE <table 1>.<column 3> = <table 2>.<column 3> GROUP BY <table 1>.<column 3>, <table 1>.<column 1>, <table 2>.<column 1> To delete a view use the DROP VIEW statement. DROP VIEW <view name> INLINE VIEWS are also referred to as queries in the FROM clause. SELECT x.<column 1>, x.<column 2>, y.<column 1>, y.<column 2> FROM <table 1> x, (SELECT <column 1 or expression>, <column 2 or expression>, <column n or expression> FROM <table 2> GROUP BY column 1) y WHERE x.<column 3> = y.<column 1> TOP-N-ANALYSIS is a SQL operation used to rank results. SELECT ROWNUM AS <column alias>, <column 1>, <column 2> FROM (SELECT <column 1>, <column 2> FROM <table> ORDER BY <column 1>) WHERE ROWNUM < <= n 8. SEQUENCES SQL has a process for automatically generating unique numbers that eliminates the worry about the details of duplicate or skipped numbers. The numbering process is handled through one of SQL's database objects called a SEQUENCE. Typically, sequences are used to create a PRIMARY KEY value. Sequence numbers are stored and generated independently of tables. Therefore, the same sequence can be used for multiple tables. Sequences are established by using the CREATE SEQUENCE statement. CREATE SEQUENCE <sequence name> [INCREMENT BY n] NOTE: Descending sequences can be created by specifying n. [START WITH n] NOTE: n can be either a positive or negative integer but cannot be 0. [{MAXVALUE n NOMAXVALUE}] [{MINVALUE n NOMINVALUE}] [{CYCLE NOCYCLE}] [{CACHE n NOCACHE}] [{ORDER NOORDER}] where Using the CACHE n option specifies how many values of the sequence the database preallocates and keeps in memory for faster access. The NOCACHE option prevents values in the sequence from being cached, which in the event of system failure prevents numbers pre-allocated and held in memory from being lost. The NOCYCLE option prevents the numbering from starting over at the START WITH value if the MAXVALUE is exceeded. Don't use the CYCLE option if the sequence is used to generate primary key values unless there is a reliable mechanism that purges old rows faster then new ones are added. Specify ORDER to guarantee that sequence numbers are generated in order of request. This clause is useful if you are using the sequence numbers as timestamps. Guaranteeing order is usually not important for sequences used to generate primary keys. After a sequence has been created you can use it to insert data into a table. The NEXTVAL pseudocolumn is used to extract successive sequence numbers from a specified sequence. You must qualify NEXTVAL with the sequence name. When you reference <sequence name>.nextval, a new sequence number is generated and the current sequence number is placed in CURRVAL. The CURRVAL pseudocolumn is used to refer to a sequence number that the current user has just generated. INSERT INTO <table name>(<column 1>, <column 2>, <column n>) VALUES (<sequence name>.nextval, <value 2>, <value 3>) Page 7of 21

8 A sequence can be changed using the ALTER SEQUENCE statement. ALTER SEQUENCE <sequence name> Modified sequence statements To view a sequence; SELECT increment_by, min_value, max_value, min_value, last_number FROM user_sequences WHERE sequence_name = '<SEQUENCE NAME>' To remove a sequence from the data dictionary, use the DROP SEQUENCE statement. DROP SEQUENCE <sequence name> 9. INDEXES Oracle uses an INDEX to speed up the retrieval of rows. An Oracle server index is a schema object that can speed up the retrieval of rows by using a pointer. Indexes can be created explicitly or automatically. If you do not have an index on the column you re selecting, then a full table scan occurs. An index provides direct and fast access to rows in a table. Its purpose is to reduce the necessity of disk I/O (input/output) by using an indexed path to locate data quickly. Null values are not included in the index. The index is used and maintained automatically by the Oracle server. Once an index is created, no direct activity is required by the user. Indexes are logically and physically independent of the table they index. This means that they can be created or dropped at any time and have no effect on the base tables or other indexes. Note: When you drop a table, corresponding indexes are also dropped. Two types of indexes can be created: a UNIQUE INDEX is an index that the Oracle server automatically creates when you define a column in a table to have a PRIMARY KEY or a UNIQUE key constraint. The name of the index is the name given to the constraint; a NON-UNIQUE INDEX is an index that a user can create to speed up access to the rows. For example, to optimize joins, you can create an index on the FOREIGN KEY column, which speeds up the search to match rows to the PRIMARY KEY column. Although you can manually create a unique index, it is recommended that you create a unique constraint in the table using the CREATE INDEX statement, which implicitly creates a unique index. CREATE INDEX <index name> ON <table> ( <column 1>, <column 2>, column n>) A FUNCTION-BASED INDEX stores the indexed values and uses the index based on a SELECT statement to retrieve the data. A function-based index is an index based on expressions. The index expression is built from table columns, constants, SQL functions, and user-defined functions. Function-based indexes are useful when you don't know in what case the data was stored in the database. Function-based indexes defined with the UPPER(<column>) or LOWER(<column>) keywords allow case-insensitive searches. CREATE INDEX <index name> ON <table> (<FUNCTION>(<column>)) To view an index: SELECT index_name, table_name, uniqueness FROM user_indexes WHERE table_name = '<TABLE>' To display the indexes and uniqueness that exist in the data dictionary for a table: SELECT ic.index_name, ic.column_name, ic.column_position col_pos,ix.uniqueness FROM user_indexes ix, user_ind_columns ic WHERE ic.index_name = ix.index_name AND ic.table_name = '<TABLE>' You cannot modify indexes. To change an index, you must drop it and then re-create it. Remove an index definition from the data dictionary by issuing the DROP INDEX statement. DROP INDEX <index name> 10. SYNONYMS In SQL, as in language, a SYNONYM is a word or expression that is an accepted substitute for another word. Synonyms are used to simplify access to objects by creating another name for the object. Synonyms can make referring to a table owned by another user easier and shorten lengthy object names. For example, to refer to another users table you can create a synonym for that table using a short name. Creating a synonym with the Page 8of 21

9 CREATE SYNONYM statement eliminates the need to qualify the object name with the schema and provides you with an alternative name for a table, view, sequence, procedure, or other objects. This method can be especially useful with lengthy object names, such as views. CREATE [OR REPLACE] [PUBLIC] SYNONYM [<schema>.]<synonym name> FOR [<schema>.] <object> Use the OR REPLACE clause to change the definition of an existing synonym without first dropping it. Specify PUBLIC to create a public synonym. Public synonyms are accessible to all users. If you omit schema (or user), then Oracle Database creates the synonym in your own schema. You cannot specify a schema for the synonym if you have specified PUBLIC. To remove a synonym use the DROP SYNONYM command. DROP [PUBLIC] SYNONYM [<schema>.]<synonym name> 11. CONSTRAINTS A CONSTRAINT is a database rule. Their definitions are stored in the data dictionary. Constraints prevent the deletion of a table if there are dependencies from other tables. Constraints enforce rules on the data whenever a row is inserted, updated or deleted from a table. When the constraint is created, it may or may not be given a name, in which case, the system gives the constraint a name such as SYS_C Note: if the word CONSTRAINT is used in the CREATE TABLE definition, you must give the constraint a name. It is best to name constraints yourself because the system-generated names are not intuitive. Types of constraints: PRIMARY KEY (pk) - to define the column or set of columns as a Primary Key that uniquely identifies each row in a table. No primary key value can appear in more than one row in the table and NULLS are not allowed. FOREIGN KEY (fk) - to define the column as a Foreign Key. The table containing the foreign key is called the child table and the table containing the referenced key is called the parent table. A foreign key must have a corresponding primary key which must be created first. Using the ON DELETE CASCADE option when defining a foreign key, enables the dependent rows in the child table to be deleted when a row in the parent table is deleted. Using the ON DELETE SET NULL option when defining a foreign key, enables the dependent rows in the child table to be set to NULL when a row in the parent table is deleted. UNIQUE (uk) - to define the column as a Unique Key. A UNIQUE constraint requires that every value in a column be unique: that is, no two rows of a table can have duplicate values. COMPOSITE UNIQUE KEY (uk) - to define a combination of columns as a Unique Key. If the combination of two columns must not be the same for any entry, the constraint is said to be a composite unique key. Can only be defined at the table level. CHECK (ck) - to require a value in the database to comply with a specified condition. A single column can have multiple CHECK constraints that reference the column in its definition. There is no limit to the number of CHECK constraints which you can define on a column. NOT NULL (nn) - to signify that the column may NOT have a Null value. Can only be defined at the column level. A COLUMN LEVEL constraint references a single column. To accomplish this, the constraint must be defined in the CREATE TABLE statement when the column is defined. CREATE TABLE <table name> (<column 1 name> <column 1 data type> CONSTRAINT <primary key name> PRIMARY KEY, <column 2 name> <column 2 data type> CONSTRAINT <foreign key name> REFERENCES <referenced table> (<referenced primary or unique key column>) [ON DELETE CASCADE/SET NULL], <column 3 name> <column 3 data type> CONSTRAINT <unique key name> UNIQUE, <column 4 name> <column 4 data type> CONSTRAINT <check key name> CHECK (<conditional expression>), <column 5 name> <column 5 data type> CONSTRAINT <not null key name> NOT NULL) Page 9of 21

10 TABLE LEVEL constraints are listed separately from the column definitions in the CREATE TABLE statement. Table level constraint definitions are stated after all the table columns have been defined. CONSTRAINT <constraint name> <TYPE OF CONSTRAINT> (<column name or condition>) CONSTRAINT <constraint name> PRIMARY KEY (<column 1>, <column 2>, <column n>) CONSTRAINT <constraint name> FOREIGN KEY (<column>) REFERENCES <referenced table> (<referenced primary or unique key column>) [ON DELETE CASCADE/SET NULL] CONSTRAINT <name> UNIQUE (<column>), CONSTRAINT <name> UNIQUE (<column 1>, <column 2>, <column n>) CONSTRAINT <name> CHECK (<conditional expression>) The ALTER TABLE statement is used to make changes to constraints in existing tables. These changes can include adding or dropping constraints, enabling or disabling constraints or adding a NOT NULL constraint to a column. You can add, drop, enable, or disable a constraint, but you cannot modify its structure. You can add a NOT NULL constraint to an existing column by using the MODIFY clause of the ALTER TABLE statement. MODIFY is used because NOT NULL is a column level change. You can define a NOT NULL column only if the table is empty or if the column has a value for every row. ALTER TABLE <table> ADD CONSTRAINT <constraint name> <TYPE OF CONSTRAINT> (<column>) ADD CONSTRAINT <constraint name> <TYPE OF CONSTRAINT> (<column>) REFERENCES <table>(<primary key column>) [ON DELETE CASCADE/NULL] MODIFY (<column> CONSTRAINT <constraint name> NOT NULL) DROP <TYPE OF CONSTRAINT> (<column>) CONSTRAINT <constraint name> [CASCADE] DROP PRIMARY KEY CASCADE DISABLE CONSTRAINT <constraint name> [CASCADE] ENABLE CONSTRAINT <constraint name> To view all constraints on a table, query the USER_CONSTRAINTS table. SELECT <constraint name>, <TYPE OF CONSTRAINT> FROM USER_CONSTRAINTS WHERE TABLE_NAME = <table> 12. DATA MANIPULATION LANGUAGE (DML) The INSERT command lets you add a row of data to the table. You may EXPLICITY list each column or IMPLICITY not list the column names. If a column can hold null values, it can be omitted from the INSERT clause. An implicit insert will automatically insert a null value in that column. To explicitly add null values to a column, use the NULL keyword in the VALUES list for those columns that can hold null values. To specify empty strings and/or missing dates use empty single quotation marks (' ') for missing data. Special values such as SYSDATE and USER can be entered in the VALUES list of an INSERT statement. SYSDATE will put the current date and time in a column. USER will return the current username which in HTML DB will be PUBLIC_USER. In addition, functions can also be used in the VALUES clause. If the keyword DEFAULT is used as a <value> and a default value was set for the column, Oracle sets the column to the default value. However, if no default value was set when the column was created, Oracle inserts a null value. Subqueries can also be used to populate the table from another table. INSERT INTO <table name>(<column 1>, <column 2>, <column n>) VALUES (<value 1>, <value 2>, <value 3>) or INSERT INTO <table name> VALUES (<value 1>, <value 2>, <value 3>) or INSERT INTO <table 1 name> SELECT <column 1 expression>, <column 2 expression>,<column 3 expression> FROM <table 2 name> or INSERT INTO <table 1 name> SELECT * FROM <table 2 name> Page 10of 21

11 The UPDATE statement is used to modify existing data in a table. If the keyword DEFAULT is used as the <value> and a default value was set for the column, Oracle sets the column to the default value. However, if no default value was set when the column was created, Oracle inserts a null value. UPDATE <table> SET <column> = <value or subquery> WHERE <condition for row select> Using the MERGE statement accomplishes two tasks at the same time. MERGE will INSERT and UPDATE simultaneously. If a value is missing, a new one is inserted, if a value exists, but needs to be changed, MERGE will update it. For each row in the target table for which the search condition is true, Oracle Database updates the row with corresponding data from the source table. If the condition is not true for any rows, then the database inserts into the target table based on the corresponding source table row. MERGE INTO <target table> USING <source table or subquery> ON <condition> WHEN MATCHED THEN UPDATE SET <target column 1> = <source column expression>, <target column 2> = <source column expression>, <target column n> = <source column expression> WHEN NOT MATCHED THEN INSERT (<target column 1 expression>, <target column 2 expression>, <target column n expression>) VALUES (<value 1>, <value 2>, <value n>) 13. DATA RETRIEVAL The DESCRIBE command displays the structure of a table. DESCRIBE <table name> The SELECT * command returns all the rows in a table. SELECT * FROM <table name> To return a subset of the data, modify the SELECT statement. SELECT <column 1 name>, <column n name> Use DISTINCT to eliminate duplicate rows. SELECT DISTINCT CASE MANIPULATION FUNCTIONS Use the UPPER function to convert alpha characters to upper case. UPPER (<column expression>) Use the LOWER function to convert alpha characters to lower case. LOWER (<column expression>) Use the INITCAP function to convert alpha character values to uppercase for the first letter of each word. INITCAP (<column expression>) 15. CHARACTER MANIPULATION FUNCTIONS In the LIKE function the % symbol is used to represent any sequence of zero or more characters. The underscore _" symbol is used to represent a single character. The backward slash \ is used to indicate that the underscore or % is part of the name not a wildcard value. If you are searching for a character at the beginning of the string, place the % symbol after the character. If you are searching for a character at the end of the string, place the % symbol before the character. If you are searching for a group of characters, place the characters in between a set of % symbols. The CONCAT function joins two string values together. A shortcut symbol may also be used. CONCAT (<column 1 expression 1>, <column 2 expression 2>) <column 1 expression 1> <column 2 expression 2> The SUBSTR function extracts a string of a determined length SUBSTR (<column expression>, <1 st character number>, <number of characters>) Page 11of 21

12 The LENGTH function shows the length of a string as a number value LENGTH (<column expression>) The INSTR function finds the numeric position of a named character INSTR (<column expression>, <character> ) The LPAD function pads the left-hand side of a character resulting in a right justified value LPAD (<column expression>, <number of positions>, <pad character> ) The RPAD function pads the right-hand side of a character string resulting in a left justified value RPAD (<column expression>, <number of positions>, <pad character> ) The TRIM function removes all specified characters either from the beginning and/or the ending of a string. If none of these are chosen (i.e. leading, trailing, both), the trim function will remove [the character(s) to be removed] from both the front and end of [string to trim] TRIM (LEADING TRAILING BOTH '<character to be trimmed>' FROM <column expression>) The REPLACE function replaces a sequence of characters in a string with another set of characters. REPLACE (<string column or expression>, <string to replace>, <replacement string> ) where string column or expression is the string that will have characters replaced in it, string to replace is the string that will be searched for and taken out of string column or expression and replacement string is the new string to be inserted in string column or expression. To convert a string value to a number so that arithmetic operations can be performed use the TO_NUMBER function. Oracle Server displays a string of hash signs(#) in place of a whole number whose digits exceed the number of digits provided in the format model and rounds numbers to the decimal place provided in the format model. TO_NUMBER (<column expression>, <format model> ) where format model is: 9 for a numeric position (number of 9 s determine width) 0 to display leading zeroes $ for a floating dollar sign L for a floating local currency symbol. to specify a decimal point in the position indicated, to specify a comma in the position indicated MI for a minus signs to the right for negative values PR to parenthesize negative numbers EEEE for scientific notation V to multiply by 10 n times (n=number of 9 s after V) B to display zero values as blank, not 0 To convert a non-date value character string to a date value use the TO_DATE function. TO_DATE (<column expression>, <format model> ) This conversion takes a non-date value character string such as 'November 3, 2001' and converts it to a date value. The format model tells the server what the character string "looks like". The fx format means "format exact" so the fxdate of the format model must exactly match the format of the date being converted. When making a character to date conversion, the fx modifier specifies exact matching for the character argument and the date format model. Punctuation and quoted text in the character argument must match the corresponding parts of the format model exactly (except for case). The character argument can not have extra blanks. Without fx, the Oracle Server ignores extra blanks. Numeric data in the character argument must have the same number of digits as the corresponding element in the format model. Without fx, numbers in the character argument can omit leading zeroes. If the date format is specified with the YY or YYYY format, the return value will be in the same century as the current century. So, if the year is 1995 and you use the YY or YYYY format, all is well and the dates will be in the 1900's. However, if the current year is 2004 and you use the YY or YYYY format for a date like 1989, you will get 2089! If the date format is specified with the RR or RRRR format, the return value has two possibilities: If the current year is between dates from 0-49 The date will be in the current century - dates from The date will be in the last century Page 12of 21

13 If the current year is between dates from 0-49 The date will be in next century - dates from The date will be in current century 16. NUMBER MANIPULATION FUNCTIONS The ROUND function is used to round numbers to a specified number of decimal places. ROUND can also be used to round numbers to the left of the decimal point and with dates. If the number of decimal places is not specified or is zero, the number will round to NO decimal places. If the number of decimal places is a positive number, the number is rounded to that number of decimal places. If the number of decimal places is a negative number, numbers to the left of the decimal are rounded. ROUND (<column expression>, <number of decimal places>) The TRUNC function is used to terminate the column, expression, date or value to a specified number of decimal places. When using TRUNC, if the number of decimal places is not specified, then the specified number defaults to zero. TRUNC (<column expression>, <number of decimal places>) The MOD function is used to return the remainder when one number is divided by another. MOD (<column expression>, <column expression>) To convert columns of number data to a desired format use the TO_CHAR function. TO_CHAR (<column expression>, '<format model>') where format model is: 9 for a numeric position (number of 9 s determine width) 0 to display leading zeroes $ for a floating dollar sign L for a floating local currency symbol. to specify a decimal point in the position indicated, to specify a comma in the position indicated MI for a minus signs to the right for negative values PR to parenthesize negative numbers EEEE for scientific notation V to multiply by 10 n times (n=number of 9 s after V) B to display zero values as blank, not 0 The POWER function is used to perform exponential calculations. Positive exponent numbers (n) are used to raise to a desired power, x n. Fractional exponent numbers (1/n) are used to extract roots, i.e.x 1/n. Rounding is suggested when extracting roots. POWER (<column expression>, exponent) 17. DATE MANIPULATION FUNCTIONS To subtract two dates: (<column 1 st date > - <column 2 nd date >) To subtract a fixed number from a date: (<column date > - <number in days>) To add a fixed number to a date: (<column date > + <number in days>) To determine the difference between two dates use the MONTHS_BETWEEN function. It is useful to use the ROUND function to restrict output. The function returns a negative number if the more recent date is stated last. ROUND (MONTHS_BETWEEN (<column 1 st date > - <column 2 nd date >), <number of decimal places>) To determine a specific day use the NEXT_DAY function. NEXT_DAY (<column date >, 'DAY OF WEEK') To determine the last day of the month for a specific date use the LAST_DAY function. LAST_DAY (<column date >) Page 13of 21

14 To add months to a specific date use the ADD_MONTHS function. ADD_MONTHS (<column date >, <number of months to add>) To convert a date to a character string use the TO_CHAR function. Any valid date format element can be included (See table). TO_CHAR (<column date >, '<format model>') - Use an fm element to remove padded blanks or remove leading zeroes from the output - Use sp to spell out a number - Use th to add st, nd, rd, or th to a number - Use double quotation marks to add character strings to format models - Use HH:MM:SS for time (HH24 for 24 hour notation; am for AM/PM notation) AD, A.D. AM, A.M. BC, B.C. D Day of week (1-7). DAY Name of day, padded with blanks to length of 9 characters. DD Day of month (1-31). DDD Day of year (1-366). DY Abbreviated name of day. FM Returns a value with no leading or trailing blanks. FX Requires exact matching between the character data and the format model. HH Hour of day (1-12). HH12 Hour of day (1-12). HH24 Hour of day (0-23). IW Week of year (1-52 or 1-53) based on the ISO standard. IYYY J 4-digit year based on the ISO standard. Julian day; the number of days since January 1, 4712 BC. Number specified with J must be integers. MI Minute (0-59). MM Month (01-12; January = 01). MON Abbreviated name of month. MONTH Name of month, padded with blanks to length of 9 characters. PM, P.M. Q Quarter of year (1, 2, 3, 4; January - March = 1). RM Roman numeral month (I-XII; January = I). RR Lets you store 20th century dates in the 21st century using only two digits. RRRR Round year. Accepts either 4-digit or 2-digit input. If 2-digit, provides the same return as RR. If you do not want this functionality, then enter the 4-digit year. SS 0 to 59.9(n), where 9(n) is the precision of interval fractional seconds SSSSS Seconds past midnight ( ). WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year. W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh. X Local radix character. Y,YYY Year with comma in this position. YEAR to 9999 (excluding year 0) SYEAR Year, spelled out; S prefixes BC dates with a minus sign (-). YYYY, YYY, Year or last 3, 2, 1 digits of year YY, Y SYYYY. 4-digit year; S prefixes BC dates with a minus sign Page 14of 21

15 18. NULL VALUE FUNCTIONS The NVL function converts a null value to either a date, a character or a number. The data types of the null value column and the new value must be the same. NVL (<value that may contain a null>, <value to replace the null>) The NVL2 function evaluates an expression with three values. If the first value is NOT null, then the NVL2 function returns the second expression. If the first value IS null, then the third expression is returned. The values in expression 1 can have any data type. Expression 2 and expression 3 can have any data type except LONG. The data type of the return value is always the same as the data type of expression 2, unless expression 2 is character data, in which it case the return type is VARCHAR2. NVL2 (<expression 1 value that may contain a null>, <expression 2 value to return if expression 1 is NOT null>, <expression 3 value to replace if expression 1 IS null>) The NULLIF function compares two functions. If they are equal, the function returns null. If they are not equal, the function returns the first expression. NULLIF (<expression 1>, <expression 2>) The COALESCE function is an extension of the NVL function except COALESCE can take multiple values. The world coalesce literally means to come "together" and that is what happens. If the first expression IS null, the function continues down the line until a NOT null expression is found. Of course, if the first expression has a value, the function returns the first expression and the function stops. COALESCE (<expression 1>, <expression 2>, <expression n>) 19. CONDITIONAL FUNCTIONS The CASE expression basically does the work of an IF-THEN-ELSE statement. The syntax for CASE is: CASE expression WHEN <comparison_expression 1> THEN <return_expression 1> WHEN <comparison_expression 2> THEN <return_expression 2> WHEN <comparison_expression n>then <return_expression n> ELSE <else_expresssion> END The DECODE function evaluates an expression in a similar way to the IF-THEN-ELSE logic (Oracle propriety). DECODE compares an expression to each of the search values. The syntax for DECODE is: DECODE (<column l expression>, search 1, result 1 [, search 2, result 2, search n, result n] [, default]) Note: If the default value is omitted, a null value is returned where a search value does not match any of the values. 20. JOINS Joins allow you to select data from more than one table. There are two classes of JOINS: Oracle Syntax and ANSI SQL:1999 Standard (See table). ORACLE Equijoin Outerjoin Selfjoin Nonequijoin Cartesian Product ANSI SQL:1999 Natural or Inner Join Left/Right/Full Outer Join Join ON Join USING Cross Join In any join three conditions must be met for the join to take place: WHAT? The SELECT clause specifies the column names to retrieve. WHERE? The FROM clause specifies the two tables that the database must access. HOW? The WHERE clause specifies how the tables are to be joined Page 15of 21

16 21. ORACLE JOINS EQUIJOIN Sometimes called a simple or inner join, an equijoin is a table join that combines rows that have equivalent values for the specified columns. SELECT <table 1>.<column>, <table 2>.<column> FROM <table 1>, <table 2> WHERE <table 1>.<column> = <table 2>.<column> CARTESIAN PRODUCT JOIN If two tables in a join query have no join condition specified in the WHERE clause or the join condition is invalid, the Oracle Server returns the Cartesian product of the two tables. This is a combination of each row of one table with each row of the other. A Cartesian product always generates many rows and is rarely useful. For example, the Cartesian product of two tables, each with 100 rows, has 10,000 rows! This may not be what you were trying to retrieve. SELECT <column 1>, <column 2> FROM <table 1>, <table 2> NONEQUIJOIN A nonequijoin is a join condition containing something other than the equality operator. It is used when you want to retrieve data from a table that has no corresponding column in another table. Use a nonequijoin when the joining of two columns in different tables does not have matching values. Instead, the match occurs within a range of values. SELECT <table 1>.<column 1>, <table 1>.<column 2>, <table 2>.<column 1> FROM <table 1>, <table 2> WHERE <table 1>.<column 1> < <table 2>.<column 2> or SELECT <table 1>.<column 1>, <table 2>.<column 1> FROM <table 1>, <table 2> WHERE <table 1>.<column 1> BETWEEN <table 2>.<column 2> AND <table 2>.<column 3> OUTER JOIN An outer join is used to see rows that have a corresponding value in another table PLUS those rows in one of the tables that have no matching value in the other table. To indicate which table may have missing data use a (+) sign after the table's column name in the query. Think of the (+) being used to fill in missing data in a column. Put the plus next to that column. Visualize plus signs filling in all the gaps. Do not place the (+) sign in both columns. SELECT <table 1>.<column 1>, <table 2>.<column 1> FROM <table 1>, <table 2> WHERE <table 1>.<column 1>(+) = <table 2>.<column 1> Left Outer WHERE <table 1>.<column 1> = <table 2>.<column 1>(+) Right Outer SELF JOIN In data modeling, it was sometimes necessary to show an entity with a relationship to itself. A special kind of join called a self join is required to access this data. To join a table to itself, the table is given two names or aliases. This will make the database think that there are two tables. Choose alias names that relate to the data's association with that table. SELECT <a.column 1>, <a.column 2>, <b.column 1> FROM <table 1> a, <table 1> b WHERE <a.column 2> = <b.column 1> 22. ANSI JOINS NATURAL JOIN A NATURAL JOIN is based on all columns in the two tables that have the same name and selects rows from the two tables that have equal values in all matched columns. SELECT <column 1>, <column 2> FROM <table 1> NATURAL JOIN <table 2> Page 16of 21

17 CROSS JOIN This is this ANSI version of a Cartesian Product Join. SELECT <column 1>, <column 2> FROM <table 1> CROSS JOIN <table 2> JOIN USING In a NATURAL JOIN, if the tables have columns with the same names but different data types, the join causes an error. To avoid this situation, the join clause can be modified with a USING clause. The USING clause specifies the columns that should be used for the join. The columns referenced in the USING clause should not have a qualifier (table name or alias) anywhere in the SQL statement. SELECT <table 1>.<column 1>, <table 2>.<column 1> FROM <table 1> JOIN <table 2> USING (<column x>) JOIN ON The ON clause can be used to specify columns to join. The advantage of the ON clause is the ability to specify the join conditions separate from the WHERE clause. The WHERE clause can then be used for search or filter conditions. The ON clause can also be used to specify arbitrary conditions such as joining columns that have different names. SELECT <table 1>.<column 1>, <table 1>.<column 2>, <table 2>.<column 1>, <table 2>.<column 2> FROM <table 1> JOIN <table 2> ON (<table 1>.<column 1> = <table 2>.<column 1>) OUTER JOINS In ANSI SQL, joins of two or more tables that return only matched rows are referred to as INNER joins. When a join returns the matched rows as well as unmatched rows it is called an OUTER join. OUTER join syntax uses the terms LEFT, FULL, and RIGHT. These names are associated with the order of the table names in a query. The results set of a FULL OUTER JOIN includes all rows in both tables even if there is no match in the other table. The following examples compare ANSI and Oracle Outer Joins. Show all Employees even if they are not assigned to a Department: SELECT e.last_name, e.department_id, d.department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id) is equivalent to SELECT e.last_name, e.department_id, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id(+) Show all Department Names even if there is no one assigned to that Department: SELECT e.last_name, e.department_id, d.department_name FROM employees e RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id) is equivalent to SELECT e.last_name, e.department_id, d.department_name FROM employees e, departments d WHERE e.department_id(+) = d.department_id Show all Employees even if they are not assigned to a Department and Show all Department Names even if there is no one assigned to that Department: SELECT e.last_name, e.department_id, d.department_name FROM employees e FULL OUTER JOIN departments d ON (e.department_id = d.department_id) Page 17of 21

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

Oracle SQL. Course Summary. Duration. Objectives

Oracle SQL. Course Summary. Duration. Objectives Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data

More information

Objectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence?

Objectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence? Oracle SQL and SQL*PLus Lesson 12: Other Database Objects Objectives After completing this lesson, you should be able to do the following: Describe some database objects and their uses Create, maintain,

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

More information

Netezza SQL Class Outline

Netezza SQL Class Outline Netezza SQL Class Outline CoffingDW education has been customized for every customer for the past 20 years. Our classes can be taught either on site or remotely via the internet. Education Contact: John

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led

More information

Managing Objects with Data Dictionary Views. Copyright 2006, Oracle. All rights reserved.

Managing Objects with Data Dictionary Views. Copyright 2006, Oracle. All rights reserved. Managing Objects with Data Dictionary Views Objectives After completing this lesson, you should be able to do the following: Use the data dictionary views to research data on your objects Query various

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.

More information

DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324

DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324 DATABASE DESIGN & PROGRAMMING WITH SQL COURSE CODE: 5324 COURSE DESCRIPTION: This curriculum is geared to meet the learning needs of a variety of students, from those interested in gaining broad exposure

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training teaches you how to write subqueries,

More information

Oracle Database 11g SQL

Oracle Database 11g SQL AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

Displaying Data from Multiple Tables

Displaying Data from Multiple Tables 4 Displaying Data from Multiple Tables Copyright Oracle Corporation, 2001. All rights reserved. Schedule: Timing Topic 55 minutes Lecture 55 minutes Practice 110 minutes Total Objectives After completing

More information

Introduction to Microsoft Jet SQL

Introduction to Microsoft Jet SQL Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of

More information

Displaying Data from Multiple Tables. Copyright 2006, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2006, Oracle. All rights reserved. Displaying Data from Multiple Tables Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equijoins and

More information

USING CONVERSION FUNCTIONS

USING CONVERSION FUNCTIONS USING CONVERSION FUNCTIONS http://www.tutorialspoint.com/sql_certificate/conversion_functions.htm Copyright tutorialspoint.com Besides the SQL utility functions, Oracle inbuilt function library contains

More information

Where? Originating Table Employees Departments

Where? Originating Table Employees Departments JOINS: To determine an employee s department name, you compare the value in the DEPARTMENT_ID column in the EMPLOYEES table with the DEPARTMENT_ID values in the DEPARTMENTS table. The relationship between

More information

SQL and Data. Learning to Retrieve Data Efficiently and Accurately

SQL and Data. Learning to Retrieve Data Efficiently and Accurately SQL and Data Learning to Retrieve Data Efficiently and Accurately Introduction Introduce the class to structured query language (SQL) using database examples We will be using SQL on a number of small business

More information

Porting from Oracle to PostgreSQL

Porting from Oracle to PostgreSQL by Paulo Merson February/2002 Porting from Oracle to If you are starting to use or you will migrate from Oracle database server, I hope this document helps. If you have Java applications and use JDBC,

More information

Database Programming with PL/SQL: Learning Objectives

Database Programming with PL/SQL: Learning Objectives Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

How To Create A Table In Sql 2.5.2.2 (Ahem)

How To Create A Table In Sql 2.5.2.2 (Ahem) Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or

More information

Database Query 1: SQL Basics

Database Query 1: SQL Basics Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic

More information

Instant SQL Programming

Instant SQL Programming Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 A feature of Oracle Rdb By Ian Smith Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal SQL:1999 and Oracle Rdb V7.1 The

More information

www.gr8ambitionz.com

www.gr8ambitionz.com Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1

More information

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved. Displaying Data from Multiple Tables Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data

More information

Conversion Functions

Conversion Functions Conversion Functions Conversion functions convert a value from one datatype to another. Generally, the form of the function names follows the convention datatype TO datatype. The first datatype is the

More information

MOC 20461C: Querying Microsoft SQL Server. Course Overview

MOC 20461C: Querying Microsoft SQL Server. Course Overview MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

IT2304: Database Systems 1 (DBS 1)

IT2304: Database Systems 1 (DBS 1) : Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation

More information

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

SQL - QUICK GUIDE. Allows users to access data in relational database management systems. http://www.tutorialspoint.com/sql/sql-quick-guide.htm SQL - QUICK GUIDE Copyright tutorialspoint.com What is SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating

More information

Firebird. Embedded SQL Guide for RM/Cobol

Firebird. Embedded SQL Guide for RM/Cobol Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...6 1.1. General...6 1.2. Reading this Guide...6 1.3. Definition of Terms...6 1.4. Declaring

More information

Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb

Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Release: 1.0 Part No. A53248-01 Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb Part No. A53248-01 Release 1.0 Copyright

More information

Information Systems SQL. Nikolaj Popov

Information Systems SQL. Nikolaj Popov Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying

More information

GET DATA FROM MULTIPLE TABLES QUESTIONS

GET DATA FROM MULTIPLE TABLES QUESTIONS GET DATA FROM MULTIPLE TABLES QUESTIONS http://www.tutorialspoint.com/sql_certificate/get_data_from_multiple_tables_questions.htm Copyright tutorialspoint.com 1.Which of the following is not related to

More information

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved. Displaying Data from Multiple Tables Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equijoins and

More information

KB_SQL SQL Reference Guide Version 4

KB_SQL SQL Reference Guide Version 4 KB_SQL SQL Reference Guide Version 4 1995, 1999 by KB Systems, Inc. All rights reserved. KB Systems, Inc., Herndon, Virginia, USA. Printed in the United States of America. No part of this manual may be

More information

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

.NET Standard DateTime Format Strings

.NET Standard DateTime Format Strings .NET Standard DateTime Format Strings Specifier Name Description d Short date pattern Represents a custom DateTime format string defined by the current ShortDatePattern property. D Long date pattern Represents

More information

ETL TESTING TRAINING

ETL TESTING TRAINING ETL TESTING TRAINING DURATION 35hrs AVAILABLE BATCHES WEEKDAYS (6.30AM TO 7.30AM) & WEEKENDS (6.30pm TO 8pm) MODE OF TRAINING AVAILABLE ONLINE INSTRUCTOR LED CLASSROOM TRAINING (MARATHAHALLI, BANGALORE)

More information

Appendix A Practices and Solutions

Appendix A Practices and Solutions Appendix A Practices and Solutions Table of Contents Practices for Lesson I... 3 Practice I-1: Introduction... 4 Practice Solutions I-1: Introduction... 5 Practices for Lesson 1... 11 Practice 1-1: Retrieving

More information

SQL. Short introduction

SQL. Short introduction SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.

More information

Structured Query Language (SQL)

Structured Query Language (SQL) Objectives of SQL Structured Query Language (SQL) o Ideally, database language should allow user to: create the database and relation structures; perform insertion, modification, deletion of data from

More information

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions

More information

Relational Database: Additional Operations on Relations; SQL

Relational Database: Additional Operations on Relations; SQL Relational Database: Additional Operations on Relations; SQL Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Overview The course packet

More information

Date / Time Arithmetic with Oracle

Date / Time Arithmetic with Oracle Date / Time Arithmetic with Oracle If you store date and time information in Oracle, you have two different options for the column's datatype - DATE and TIMESTAMP. DATE is the datatype that we are all

More information

A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX

A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX ISSN: 2393-8528 Contents lists available at www.ijicse.in International Journal of Innovative Computer Science & Engineering Volume 3 Issue 2; March-April-2016; Page No. 09-13 A Comparison of Database

More information

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded

More information

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Objectives The objective of this lab is to learn the query language of SQL. Outcomes After completing this Lab,

More information

5. CHANGING STRUCTURE AND DATA

5. CHANGING STRUCTURE AND DATA Oracle For Beginners Page : 1 5. CHANGING STRUCTURE AND DATA Altering the structure of a table Dropping a table Manipulating data Transaction Locking Read Consistency Summary Exercises Altering the structure

More information

Fundamentals of Database Design

Fundamentals of Database Design Fundamentals of Database Design Zornitsa Zaharieva CERN Data Management Section - Controls Group Accelerators and Beams Department /AB-CO-DM/ 23-FEB-2005 Contents : Introduction to Databases : Main Database

More information

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries

More information

Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

More information

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina This Lecture Database Systems Lecture 5 Natasha Alechina The language, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly and Begg chapter

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. You are creating the EMPLOYEES

More information

Utility Software II lab 1 Jacek Wiślicki, jacenty@kis.p.lodz.pl original material by Hubert Kołodziejski

Utility Software II lab 1 Jacek Wiślicki, jacenty@kis.p.lodz.pl original material by Hubert Kołodziejski MS ACCESS - INTRODUCTION MS Access is an example of a relational database. It allows to build and maintain small and medium-sized databases and to supply them with a graphical user interface. The aim of

More information

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

History of SQL. Relational Database Languages. Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG)

History of SQL. Relational Database Languages. Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG) Relational Database Languages Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG) Domain relational calculus QBE (used in Access) History of SQL Standards:

More information

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt Lesson Notes Author: Pamela Schmidt Tables Text Fields (Default) Text or combinations of text and numbers, as well as numbers that don't require calculations, such as phone numbers. or the length set by

More information

4 Logical Design : RDM Schema Definition with SQL / DDL

4 Logical Design : RDM Schema Definition with SQL / DDL 4 Logical Design : RDM Schema Definition with SQL / DDL 4.1 SQL history and standards 4.2 SQL/DDL first steps 4.2.1 Basis Schema Definition using SQL / DDL 4.2.2 SQL Data types, domains, user defined types

More information

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved.

Recognizing PL/SQL Lexical Units. Copyright 2007, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: List and define the different types of lexical units available in PL/SQL Describe identifiers and identify valid and invalid identifiers in PL/SQL

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. Which SQL statement below will

More information

Access Queries (Office 2003)

Access Queries (Office 2003) Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality

More information

Mini User's Guide for SQL*Plus T. J. Teorey

Mini User's Guide for SQL*Plus T. J. Teorey Mini User's Guide for SQL*Plus T. J. Teorey Table of Contents Oracle/logging-in 1 Nested subqueries 5 SQL create table/naming rules 2 Complex functions 6 Update commands 3 Save a query/perm table 6 Select

More information

Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois

Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Abstract This paper introduces SAS users with at least a basic understanding of SAS data

More information

Financial Data Access with SQL, Excel & VBA

Financial Data Access with SQL, Excel & VBA Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,

More information

More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan

More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan More on SQL Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan SELECT A1, A2,, Am FROM R1, R2,, Rn WHERE C1, C2,, Ck Interpreting a Query

More information

Oracle 10g PL/SQL Training

Oracle 10g PL/SQL Training Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural

More information

Key Functions in Oracle SQL

Key Functions in Oracle SQL Page 1 of 6 Key Functions in Oracle SQL Use this Quick Reference Guide to locate functions you can use in your queries. There are five tables in this guide: Grouping Functions, Numeric Functions, String

More information

Guide to Performance and Tuning: Query Performance and Sampled Selectivity

Guide to Performance and Tuning: Query Performance and Sampled Selectivity Guide to Performance and Tuning: Query Performance and Sampled Selectivity A feature of Oracle Rdb By Claude Proteau Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal Sampled

More information

CHAPTER 12. SQL Joins. Exam Objectives

CHAPTER 12. SQL Joins. Exam Objectives CHAPTER 12 SQL Joins Exam Objectives In this chapter you will learn to 051.6.1 Write SELECT Statements to Access Data from More Than One Table Using Equijoins and Nonequijoins 051.6.2 Join a Table to Itself

More information

SQL Server. 1. What is RDBMS?

SQL Server. 1. What is RDBMS? SQL Server 1. What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained

More information

How Strings are Stored. Searching Text. Setting. ANSI_PADDING Setting

How Strings are Stored. Searching Text. Setting. ANSI_PADDING Setting How Strings are Stored Searching Text SET ANSI_PADDING { ON OFF } Controls the way SQL Server stores values shorter than the defined size of the column, and the way the column stores values that have trailing

More information

P_Id LastName FirstName Address City 1 Kumari Mounitha VPura Bangalore 2 Kumar Pranav Yelhanka Bangalore 3 Gubbi Sharan Hebbal Tumkur

P_Id LastName FirstName Address City 1 Kumari Mounitha VPura Bangalore 2 Kumar Pranav Yelhanka Bangalore 3 Gubbi Sharan Hebbal Tumkur SQL is a standard language for accessing and manipulating databases. What is SQL? SQL stands for Structured Query Language SQL lets you access and manipulate databases SQL is an ANSI (American National

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

Advance DBMS. Structured Query Language (SQL)

Advance DBMS. Structured Query Language (SQL) Structured Query Language (SQL) Introduction Commercial database systems use more user friendly language to specify the queries. SQL is the most influential commercially marketed product language. Other

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

Database Extensions Visual Walkthrough. PowerSchool Student Information System

Database Extensions Visual Walkthrough. PowerSchool Student Information System PowerSchool Student Information System Released October 7, 2013 Document Owner: Documentation Services This edition applies to Release 7.9.x of the PowerSchool software and to all subsequent releases and

More information

2. Which three statements about functions are true? (Choose three.) Mark for Review (1) Points

2. Which three statements about functions are true? (Choose three.) Mark for Review (1) Points 1. Which SQL function can be used to remove heading or trailing characters (or both) from a character string? LPAD CUT NVL2 TRIM (*) 2. Which three statements about functions are true? (Choose three.)

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Microsoft Excel 2010 Part 3: Advanced Excel

Microsoft Excel 2010 Part 3: Advanced Excel CALIFORNIA STATE UNIVERSITY, LOS ANGELES INFORMATION TECHNOLOGY SERVICES Microsoft Excel 2010 Part 3: Advanced Excel Winter 2015, Version 1.0 Table of Contents Introduction...2 Sorting Data...2 Sorting

More information

3 Data Properties and Validation Rules

3 Data Properties and Validation Rules 3 Data Properties and Validation Rules 3.1 INTRODUCTION Once a database table has been created and the fields named and the type of data which is to be stored in the field chosen, you can make further

More information

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to: D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led

More information

LOBs were introduced back with DB2 V6, some 13 years ago. (V6 GA 25 June 1999) Prior to the introduction of LOBs, the max row size was 32K and the

LOBs were introduced back with DB2 V6, some 13 years ago. (V6 GA 25 June 1999) Prior to the introduction of LOBs, the max row size was 32K and the First of all thanks to Frank Rhodes and Sandi Smith for providing the material, research and test case results. You have been working with LOBS for a while now, but V10 has added some new functionality.

More information

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 5 Retreiving Data from Multiple Tables Eng. Alaa O Shama November, 2015 Objectives:

More information

Apache Cassandra Query Language (CQL)

Apache Cassandra Query Language (CQL) REFERENCE GUIDE - P.1 ALTER KEYSPACE ALTER TABLE ALTER TYPE ALTER USER ALTER ( KEYSPACE SCHEMA ) keyspace_name WITH REPLICATION = map ( WITH DURABLE_WRITES = ( true false )) AND ( DURABLE_WRITES = ( true

More information

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY 2.1 Introduction In this chapter, I am going to introduce Database Management Systems (DBMS) and the Structured Query Language (SQL), its syntax and usage.

More information

REPORT GENERATION USING SQL*PLUS COMMANDS

REPORT GENERATION USING SQL*PLUS COMMANDS Oracle For Beginners Page : 1 Chapter 14 REPORT GENERATION USING SQL*PLUS COMMANDS What is a report? Sample report Report script Break command Compute command Column command Ttitle and Btitle commands

More information

RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague

RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague course: Database Applications (NDBI026) WS2015/16 RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague student duties final DB

More information