GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

Size: px
Start display at page:

Download "GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement"

Transcription

1 GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016

2 Introduction to Lab-2 This lab reinforces the concepts introduced in Lab-1 and extends the usage of the SELECT statement for data selection and data filtering. Is also introduces the usage of common arithmetic function using the SELECT statement. Finally, students are introduced to the usage of WHERE clause for the selection of data using the SELECT statement. The main topics of this lab include: 1. Introduction to Structured Query Language (SQL) 2. Capabilities of SQL SELECT Statements 3. Basic SELECT Statement 4. Selecting ALL Columns 5. Selecting Specific Columns 6. Writing SELECT Statements 7. Column Heading Defaults 8. Arithmetic Expressions 9. Using Arithmetic Operators 10. Operator Precedence & Parenthesis 11. Column Aliases 12. Null Values 13. Concatenation Operator ( ) 14. Literal Character Strings 15. Eliminating Duplicate Rows 16. Limiting Rows Using Selection: the WHERE Clause 17. Character Strings and Dates 18. Comparison Conditions (=, >, <, >=, <=, <>, BETWEEN, IN, LIKE, IS NULL) 19. String Wildcards (%, _) 20. Using the NULL Conditions 21. Logical Conditions (AND, OR, NOT) 22. ORDER BY Clause 23. Practice SQL Statements 24. SOLUTIONS: Practice SQL Statements Objectives of this Lab At the end of this lab, students should be able to: Understand the usage of SELECT statement for displaying selected rows Understand the usage of various conditional and logical operators in the SELECT statement Understand the usage of simple string matching using LIKE and string wildcards Spring 2016 CS-217: Database Systems (Lab) Page 1

3 Understand how to use the SQL SELECT statement for creating queries having multiple selection criteria Understand how to display data in sorted order using the SELECT statement 1. Introduction to Structured Query Language (SQL) SQL (Structured Query Language) is the standard relational query language with statements to create, remove, retrieve and maintain data in a relational database. SQL contains three main types of commands, Data Definition language (DDL), Data Manipulation language (DML), and Data Control language (DCL) statements. 2. Capabilities of SQL SELECT Statements The SELECT statement is the most frequently used statement in SQL; it is used to retrieve data from one or more tables. The names of the tables used in the statement must be listed in the statement. Using a SELECT statement, you can do the following: Projection: Choose the columns in a table that are returned by a query. Choose as few or as many of the columns as needed Selection: Choose the rows in a table that are returned by a query. Various criteria can be used to restrict the rows that are retrieved. Spring 2016 CS-217: Database Systems (Lab) Page 2

4 Joining: Bring together data that is stored in different tables by specifying the link between them. SQL joins are covered in more detail in a later lab. 3. Basic SELECT Statement SELECT * {[DISTINCT] column expression [alias],...} FROM table; In its simplest form, a SELECT statement must include the following: A SELECT clause, which specifies the columns to be displayed A FROM clause, which identifies the table containing the columns that are listed in the SELECT clause In the syntax: SELECT is a list of one or more columns * selects all columns DISTINCT suppresses duplicates column expression selects the named column or the expression alias gives selected columns different headings FROM table specifies the table containing the columns Note: Throughout these labs, the words keyword, clause, and statement are used as follows: A keyword refers to an individual SQL element. For example, SELECT and FROM are keywords. A clause is a part of a SQL statement. For example, SELECT employee_id, last_name,... is a clause. A statement is a combination of two or more clauses. For example, SELECT * loyees is a SQL statement. 4. Selecting ALL Columns SELECT * FROM dept; You can display all columns of data in a table by following the SELECT keyword with an asterisk (*).You can also display all columns in the table by listing all the columns after the SELECT keyword. 5. Selecting Specific Columns You can use the SELECT statement to display specific columns of the table by specifying the column names, separated by commas. This example below displays all the employee numbers, employee names, and salaries from the EMP table. SELECT empno, ename, sal ; Spring 2016 CS-217: Database Systems (Lab) Page 3

5 Note: In the SELECT clause, specify the columns that you want, in the order in which you want them to appear in the output. 6. Writing SELECT Statements Using the following simple rules and guidelines, you can construct valid statements that are both easy to read and easy to edit: SQL statements are not case-sensitive (unless indicated). SQL statements can be entered on one or many lines. Keywords cannot be split across lines or abbreviated. Clauses are usually placed on separate lines for readability and ease of editing. Indents should be used to make code more readable. Keywords typically are entered in uppercase; all other words, such as table names and columns, are entered in lowercase. 7. Column Heading Defaults In SQL+, column headings are displayed as uppercase. The column names are used for the default headings. For example, SELECT empno, ename, job ; Note: Character and Date column headings are left-aligned. Number column headings are rightaligned. 8. Arithmetic Expressions You may need to modify the way in which data is displayed, or you may want to perform calculations or look at what-if scenarios. These are all possible using arithmetic expressions. An arithmetic expression can contain column names, constant numeric values, and the arithmetic operators. Arithmetic Operators The following arithmetic operators are available in SQL. You can use arithmetic operators in any clause of a SQL statement (except the FROM clause). Operator Description + Add - Subtract * Multiply / Divide Spring 2016 CS-217: Database Systems (Lab) Page 4

6 Note: With DATE and TIMESTAMP data types, you can use the addition and subtraction operators only. 9. Using Arithmetic Operators You can create expressions using date and numeric data using mathematical operators (+, -, *, /). SELECT ename, sal, sal ; This example uses the addition operator to calculate a salary increase of $300 for all employees. This example also displays a SAL+300 column in the output. Note that the resultant calculated column SAL+300 is not a new column in the EMP table; it is for display only. By default, the name of a new column comes from the calculation that generated it in this case, sal+300. Note: The Oracle server ignores blank spaces before and after the arithmetic operator. 10. Operator Precedence & Parenthesis In mathematical expressions, multiplication and division takes priority over addition and subtraction. If operators within an expression are of same priority, then evaluation is done from left to right. You can use parenthesis to force the expression within parenthesis to be evaluated first. SELECT ename, sal, 12*sal+100 ; You can override the rules of precedence by using parentheses to specify the desired order in which operators are to be executed. SELECT ename, sal, 12*(sal+100) ; Rules of Precedence: Multiplication and division occur before addition and subtraction. Operators of the same priority are evaluated from left to right. Parentheses are used to override the default precedence or to clarify the statement. Spring 2016 CS-217: Database Systems (Lab) Page 5

7 11. Column Aliases You can override a column heading display with a column alias. It renames a column heading into something that is specified by the user. It is useful for reporting and calculations. The alias immediately follows the column name and is enclosed in double quotation marks. There could also be an optional AS keyword between the column name and the alias name. For example, 1. SELECT ename AS Employee Name ; 2. SELECT ename Employee Name, mgr Manager ; 3. SELECT ename Employee Name, sal*12 Annual Salary ; 12. Null Values A null is a value that is unavailable, unassigned, unknown, or inapplicable. If a column is missing a value, then that column is said to be null, or contains null. A null is not the same as a zero or a space. A zero is a number, and a space is a character. SELECT ename, sal, comm ; Applying a mathematical operator on a null value does not change its value. SELECT ename, sal, comm AS New Commission ; Note: Columns of any data type can contain nulls. However, some constraints (NOT NULL and PRIMARY KEY) prevent nulls from being used in the column. In the COMM column in the EMP table, notice that only a sales manager or sales representative can earn a commission. Other employees are not entitled to earn commissions. A null represents that fact. 13. Concatenation Operator ( ) You can link columns to other columns, arithmetic expressions, or constant values to create a character expression by using the concatenation operator ( ). Columns on either side of the operator are combined to make a single output column. 1. SELECT ename job ; 2. SELECT ename job AS New Data ; Spring 2016 CS-217: Database Systems (Lab) Page 6

8 Null Values with the Concatenation Operator If you concatenate a null value with a character string, the result is a character string. ENAME NULL results in ENAME. 14. Literal Character Strings A literal value is a character, a number, or a date that is included in the SELECT list and that is not a column name or a column alias. It is printed for each row returned. Date and character literals must be enclosed in single quotation marks ( ). Number literals need not. 1. SELECT Employee ename works as a job Employee Details ; 2. SELECT Employee ename was hired on hiredate is working as job and is getting sal AS New Data ; 15. Eliminating Duplicate Rows The default display of queries is all rows, including duplicate rows. SELECT deptno ; To eliminate duplicate rows in the result, include the DISTINCT keyword in the SELECT clause immediately after the SELECT keyword. SELECT DISTINCT deptno ; You can specify multiple columns after the DISTINCT qualifier. The DISTINCT qualifier affects all the selected columns, and the result is every distinct combination of the columns. SELECT DISTINCT deptno, job ; 16. Limiting Rows Using Selection: the WHERE Clause You can restrict the rows returned from the query by using the WHERE clause. A WHERE clause contains a condition that must be met, and it directly follows the FROM clause. If the condition is true, the row meeting the condition is returned. SELECT <criteria> FROM <table> [WHERE condition(s)]; Spring 2016 CS-217: Database Systems (Lab) Page 7

9 The WHERE clause can compare values in columns, literal values, arithmetic expressions, or functions. SELECT empno, ename, job, deptno WHERE deptno = 30; 17. Character Strings and Dates Character strings and dates in the WHERE clause must be enclosed in single quotation marks ( ). Number constants should not be enclosed in single quotation marks. All character searches are case sensitive. 1. SELECT empno, job, deptno WHERE ename = WARD ; 2. SELECT * WHERE hiredate = ; 3. SELECT * WHERE ename = king ; 4. SELECT empno, ename, job, deptno WHERE deptno = 30; Note: Oracle databases store dates in an internal numeric format, representing the century, year, month, day, hours, minutes, and seconds. The default date display is DD-MON-RR. 18. Comparison Conditions Comparison conditions are used in conditions that compare one expression to another value or expression. Operator Meaning = Equal to > Greater than >= Greater than or equal to < Less than Spring 2016 CS-217: Database Systems (Lab) Page 8

10 <= Less than or equal to <>,!=, ^= Not equal to BETWEEN AND IN (set) LIKE IS NULL Between two values inclusive Match any of a list a values Match a character pattern Is a null value Note: 1. SELECT empno, ename, job, sal WHERE sal <= 3000; 2. SELECT * WHERE hiredate > ; 3. SELECT ename, sal WHERE sal BETWEEN 2500 AND 3500; 4. SELECT empno, ename, sal, deptno WHERE mgr IN (7698, 7566, 7782); 5. SELECT empno, ename WHERE ename BETWEEN KING AND SMITH ; 6. SELECT empno, ename WHERE ename IN ( KING, SMITH ); An alias cannot be used in the WHERE clause. Values that are specified with the BETWEEN condition are inclusive. You must specify the lower limit first. You can also use the BETWEEN condition on character values. The IN condition can be used with any data type. Spring 2016 CS-217: Database Systems (Lab) Page 9

11 19. String Wildcards ( %, _ ) You may select rows that match a character pattern by using the LIKE condition. The character pattern-matching operation is referred to as wildcard search. Two symbols can be used to construct the search string: Symbol Description % Represents any sequence of zero or more characters _ Represents any single character 1. SELECT empno, ename, job, sal WHERE ename LIKE S% ; 2. SELECT empno, ename, job, sal WHERE ename LIKE _I% ; 3. SELECT empno, ename, job, sal WHERE ename LIKE %N ; The LIKE condition can be used as a shortcut for some BETWEEN comparisons. The following example displays the last names and hire dates of all employees who joined between January 1995 and December 1995: SELECT ename, hiredate WHERE hiredate LIKE '%95'; 20. Using the NULL Conditions The NULL conditions include the IS NULL condition and the IS NOT NULL condition. The IS NULL condition tests for nulls. We cannot use a = to test nulls. 1. SELECT empno, ename, job, sal WHERE mgr IS NULL; 2. SELECT empno, ename, job, sal WHERE comm IS NOT NULL; Spring 2016 CS-217: Database Systems (Lab) Page 10

12 3. SELECT empno, ename, sal, deptno WHERE comm IS NULL; 4. SELECT empno, ename, sal, deptno WHERE comm IS NOT NULL; 21. Logical Conditions (AND, OR, NOT) A logical condition combines the result of two component conditions to produce a single result based on them or inverts the result of a single condition. A row is returned only if the overall result of the condition is true. Operator AND OR NOT Meaning Returns TRUE if both component conditions are true Returns TRUE if either component condition is true Returns TRUE if the following condition is false 1. SELECT empno, ename, job, sal WHERE sal >= 2000 AND job LIKE %MAN% ; 2. SELECT empno, ename, job, sal WHERE sal >= 2000 OR job LIKE %MAN% ; 3. SELECT empno, ename, job, sal WHERE job NOT IN ( PRESIDENT, CLERK ); 22. ORDER BY Clause The order of rows returned in a query result is undefined. The ORDER BY clause can be used to sort the rows. If you use the ORDER BY clause, it must be the last clause of the SELECT statement. The value ASC will be used to sort data in ascending order (default order), and DESC will sort the data in descending order. 1. SELECT ename, job, sal ORDER BY hiredate; 2. SELECT ename, job, sal Spring 2016 CS-217: Database Systems (Lab) Page 11

13 ORDER BY empno DESC; You can also sort using the column alias in the ORDER BY clause. SELECT ename, sal, 12 * sal AS NewSal ORDER BY NewSal; You can also sort query result on more than one column. SELECT empno, ename, sal, deptno ORDER BY deptno, sal DESC; You can also sort by a column that is not included in the SELECT list. 23. Practice SELECT Statements Write SELECT statements for the following: 1. List the names and jobs for all employees. 2. List the employee ids, hire dates, and department numbers of all employees. 3. List the names, salaries and hire dates of all employees. 4. List the department number and names of all departments. 5. List the locations of all departments. 6. List the names and locations of all departments. 7. List all the grades and the low salary figures. 8. List all the low and high salary figures. 9. List all data from the department table. 10. List all data from the bonus table. 11. List all data from the salgrade table. 12. Create a query to display unique jobs from the employee table. 13. Display the name concatenated with job, separated by a comma and space, and name the column Employee and Title. 14. Create a query to display all the data from the employee table. Separate each column by a comma. Name the column The_Output. 15. Create a query to display the name and salary of employees earning more than Create a query to display the name and department number for employee number Display the employee name, job, and start date of employees hired between June 9, 1981 and July 13, Display the name and department number of all employees in departments 20 and 30 in alphabetical order by name. Spring 2016 CS-217: Database Systems (Lab) Page 12

14 19. Display the name and hiredate of every employee who was hired on July 13, Display the name and job title of all employees who do not have a manager. 21. Display the name, salary and commission of all employees who earn commission. Sort the data in descending order of salary and commissions. 22. Display the names of all employees where the third letter of the name is A. 23. Display the names of all employees who have an A and E in their names. 24. Display the name, job, and salary of all employees whose job is salesman or clerk and whose salary is not equal to 1000, 1500, or Due to budget issues, the HR department needs a report that displays the name and salary of employees who earn more than $2,000. Place your SQL statement in a text file named lab_02_01.sql. Run your query. 26. The HR departments needs to find high-salary and low-salary employees. Modify lab_02_01.sql to display the name and salary for any employee whose salary is not in the range of $1,500 to $3,000. Place your SQL statement in a text file named lab_02_03.sql. 27. Create a report to display the last name, job ID, and start date for the employees with the names of Allen and Blake. Order the query in ascending order by start date. 28. Display the last name and department number of all employees in departments 10 or 30 in ascending alphabetical order by name. 29. Modify lab_02_03.sql to display the last name and salary of employees who earn between $2,200 and $2,900 and are in department 20 or 30. Label the columns Employee and Monthly Salary, respectively. Resave lab_02_03.sql as lab_02_06.sql. Run the statement in lab_02_06.sql. 30. The HR department needs a report that displays the last name and hire date for all employees who were hired in Modify lab_02_06.sql to display the last name, salary, and commission for all employees whose commission amount is 20%. Resave lab_02_06.sql as lab_02_15.sql. Rerun the statement in lab_02_15.sql. Spring 2016 CS-217: Database Systems (Lab) Page 13

15 24. SOLUTIONS: Practice SELECT Statements 1. SELECT ename, job ; 2. SELECT empno, hiredate, deptno ; 3. SELECT ename, sal, hiredate ; 4. SELECT deptno, dname FROM dept; 5. SELECT loc FROM dept; 6. SELECT dname, loc FROM dept; 7. SELECT grade, losal FROM salgrade; 8. SELECT losal, hisal FROM salgrade; 9. SELECT * FROM dept; 10. SELECT * FROM bonus; 11. SELECT * FROM salgrade; 12. SELECT DISTINCT(job) ; 13. SELECT ename, job AS Employee and Title ; 14. SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno AS The_Output ; 15. SELECT ename, sal WHERE sal > 1000; 16. SELECT ename, deptno WHERE empno = 7566; 17. SELECT ename, job, hiredate WHERE hiredate BETWEEN 9-JUN-81 AND 13-JUL-87 ; 18. SELECT ename, deptno WHERE deptno IN(20, 30) ORDER BY ename; 19. SELECT ename, hiredate WHERE hiredate = 13-JUL-87 ; 20. SELECT ename, job WHERE mgr IS NULL; 21. SELECT ename, sal, comm WHERE comm IS NOT NULL ORDER BY sal DESC, comm DESC; 22. SELECT ename WHERE ename LIKE A% ; 23. SELECT ename WHERE ename LIKE %A%E% ; 24. SELECT ename, job, sal WHERE job IN( SALESMAN, CLERK ) AND sal NOT IN(1000, 1500, 2000); Spring 2016 CS-217: Database Systems (Lab) Page 14

16 25. SELECT ename, sal WHERE sal > 2000; Copy this query in a text file, named as lab_02_01.sql. Open the.sql file for query execution. 26. SELECT ename, sal WHERE sal NOT BETWEEN 1500 AND 3000; Place this query in a file named lab_02_03.sql. 27. SELECT ename, job, hiredate WHERE ename IN( ALLEN, BLAKE ) ORDER BY hiredate; 28. SELECT ename, deptno WHERE deptno IN(10, 30) ORDER BY ename; 29. SELECT ename AS Employee, sal AS Salary WHERE ( sal BETWEEN 2200 AND 2900 ) AND ( deptno IN(20, 30) ) ; Place this query in a file named lab_02_06.sql. Open the.sql file for query execution. 30. SELECT ename, hiredate WHERE hiredate LIKE %94 ; 31. SELECT ename, sal, comm WHERE comm = 0.2; Place this query in a file named lab_02_15.sql. Open the.sql file for query execution. Spring 2016 CS-217: Database Systems (Lab) Page 15

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

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

More information

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

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, 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

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

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, 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

RETRIEVING DATA USING THE SQL SELECT STATEMENT

RETRIEVING DATA USING THE SQL SELECT STATEMENT RETRIEVING DATA USING THE SQL SELECT STATEMENT Course Objectives List the capabilities of SQL SELECT statements Execute a basic SELECT statement Development Environments for SQL Lesson Agenda Basic SELECT

More information

CS2 Current Technologies Lecture 2: SQL Programming Basics

CS2 Current Technologies Lecture 2: SQL Programming Basics T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 2: SQL Programming Basics Dr Chris Walton (cdw@dcs.ed.ac.uk) 4 February 2002 The SQL Language 1 Structured Query Language

More information

CS2 Current Technologies Note 1 CS2Bh

CS2 Current Technologies Note 1 CS2Bh CS2 Current Technologies Note 1 Relational Database Systems Introduction When we wish to extract information from a database, we communicate with the Database Management System (DBMS) using a query language

More information

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved. Restricting and Sorting Data Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort the rows that are retrieved by a query Use

More information

GIFT Department of Computing Science. [Spring 2016] CS-217: Database Systems. Lab-3 Manual. Single Row Functions in SQL

GIFT Department of Computing Science. [Spring 2016] CS-217: Database Systems. Lab-3 Manual. Single Row Functions in SQL GIFT Department of Computing Science [Spring 2016] CS-217: Database Systems Lab-3 Manual Single Row Functions in SQL V3.0 4/26/2016 Introduction to Lab-3 Functions make the basic query block more powerful,

More information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries Chris Walton (cdw@dcs.ed.ac.uk) 11 February 2002 Multiple Tables 1 Redundancy requires excess

More information

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved. Restricting and Sorting Data Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort

More information

RESTRICTING AND SORTING DATA

RESTRICTING AND SORTING DATA RESTRICTING AND SORTING DATA http://www.tutorialspoint.com/sql_certificate/restricting_and_sorting_data.htm Copyright tutorialspoint.com The essential capabilities of SELECT statement are Selection, Projection

More information

GIFT Department of Computing Science. CS-217: Database Systems. Lab-4 Manual. Reporting Aggregated Data using Group Functions

GIFT Department of Computing Science. CS-217: Database Systems. Lab-4 Manual. Reporting Aggregated Data using Group Functions GIFT Department of Computing Science CS-217: Database Systems Lab-4 Manual Reporting Aggregated Data using Group Functions V3.0 4/28/2016 Introduction to Lab-4 This lab further addresses functions. It

More information

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables INDEX Exercise No Title 1 Basic SQL Statements 2 Restricting and Sorting Data 3 Single Row Functions 4 Displaying data from multiple tables 5 Creating and Managing Tables 6 Including Constraints 7 Manipulating

More information

SQL. Char (30) can store ram, ramji007 or 80- b

SQL. Char (30) can store ram, ramji007 or 80- b SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database

More information

GIFT Department of Computing Science. CS-217/224: Database Systems. Lab-5 Manual. Displaying Data from Multiple Tables - SQL Joins

GIFT Department of Computing Science. CS-217/224: Database Systems. Lab-5 Manual. Displaying Data from Multiple Tables - SQL Joins GIFT Department of Computing Science CS-217/224: Database Systems Lab-5 Manual Displaying Data from Multiple Tables - SQL Joins V3.0 5/5/2016 Introduction to Lab-5 This lab introduces students to selecting

More information

King Fahd University of Petroleum and Minerals

King Fahd University of Petroleum and Minerals 1 King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 334: Database Systems Semester 041 Major Exam 1 18% ID: Name: Section: Grades Section Max Scored A 5 B 25

More information

Objectives. After completing this lesson, you should be able to do the following:

Objectives. After completing this lesson, you should be able to do the following: 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 equality and nonequality joins View data that generally

More information

Introduction. Introduction to Oracle: SQL and PL/SQL

Introduction. Introduction to Oracle: SQL and PL/SQL Introduction Introduction to Oracle: SQL and PL/SQL 1 Objectives After completing this lesson, you should be able to do the following: Discuss the theoretical and physical aspects of a relational database

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

Real-World Performance Training SQL Introduction

Real-World Performance Training SQL Introduction Real-World Performance Training SQL Introduction Real-World Performance Team Basics SQL Structured Query Language Declarative You express what you want to do, not how to do it Despite the name, provides

More information

Database implementation Further SQL

Database implementation Further SQL IRU SEMESTER 2 January 2010 Semester 1 Session 2 Database implementation Further SQL Objectives To be able to use more advanced SQL statements, including Renaming columns Order by clause Aggregate functions

More information

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Part III Data Modelling Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Outline of this part (I) 1 Introduction to the Relational Model and SQL Relational Tables Simple Constraints

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies Databases - 4 Other relational operations and DDL How to write RA expressions for dummies Step 1: Identify the relations required and CP them together Step 2: Add required selections to make the CP Step

More information

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse.

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse. Database Management System * First install Mysql Database or Wamp Server which contains Mysql Databse. * Installation steps are provided in pdf named Installation Steps of MySQL.pdf or WAMP Server.pdf

More information

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree

More information

Full file at

Full file at David Kroenke's Database Processing: Fundamentals, Design and Implementation (10 th Edition) CHAPTER TWO INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) True-False Questions 1. SQL stands for Standard

More information

Objectives. After completing this lesson, you should be able to do the following:

Objectives. After completing this lesson, you should be able to do the following: Objectives After completing this lesson, you should be able to do the following: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries Write single-row

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 2-1 Objectives This lesson covers the following objectives: Apply the concatenation operator to link columns to other columns, arithmetic expressions, or constant values to

More information

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University 1 Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University Lecture 3 Part A CIS 311 Introduction to Management Information Systems (Spring 2017)

More information

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Using the Set Operators. Copyright 2006, Oracle. All rights reserved. Using the Set Operators Objectives After completing this lesson, you should be able to do the following: Describe set operators Use a set operator to combine multiple queries into a single query Control

More information

Getting Information from a Table

Getting Information from a Table ch02.fm Page 45 Wednesday, April 14, 1999 2:44 PM Chapter 2 Getting Information from a Table This chapter explains the basic technique of getting the information you want from a table when you do not want

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

chapter 2 G ETTING I NFORMATION FROM A TABLE

chapter 2 G ETTING I NFORMATION FROM A TABLE chapter 2 Chapter G ETTING I NFORMATION FROM A TABLE This chapter explains the basic technique for getting the information you want from a table when you do not want to make any changes to the data and

More information

Oracle Database 10g: SQL Fundamentals I

Oracle Database 10g: SQL Fundamentals I Oracle Database 10g: SQL Fundamentals I Electronic Presentation D17108GC11 Production 1.1 August 2004 D39769 Author Nancy Greenberg Technical Contributors and Reviewers Wayne Abbott Christian Bauwens Perry

More information

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-3 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

SYSTEM CODE COURSE NAME DESCRIPTION SEM

SYSTEM CODE COURSE NAME DESCRIPTION SEM Course: CS691- Database Management System Lab PROGRAMME: COMPUTER SCIENCE & ENGINEERING DEGREE:B. TECH COURSE: Database Management System Lab SEMESTER: VI CREDITS: 2 COURSECODE: CS691 COURSE TYPE: Practical

More information

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved. Working with Columns, Characters and Rows What Will I Learn? In this lesson, you will learn to: Apply the concatenation operator to link columns to other columns, arithmetic expressions or constant values

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and

More information

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36 Database Processing, 12e (Kroenke/Auer) Chapter 2: Introduction to Structured Query Language (SQL) 1) SQL stands for Standard Query Language. Diff: 1 Page Ref: 32 2) SQL includes a data definition language,

More information

Pivot Tables Motivation (1)

Pivot Tables Motivation (1) Pivot Tables The Pivot relational operator (available in some SQL platforms/servers) allows us to write cross-tabulation queries from tuples in tabular layout. It takes data in separate rows, aggregates

More information

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value Databases - 3 Null, Cartesian Product and Join Null Null is a value that we use when Something will never have a value Something will have a value in the future Something had a value but doesn t at the

More information

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel 1 In this chapter, you will learn: The basic commands

More information

Oracle Database: SQL Fundamentals I. Oracle Internal & Oracle Academy Use Only. Volume II Student Guide. D64258GC10 Edition 1.0 January 2010 D65028

Oracle Database: SQL Fundamentals I. Oracle Internal & Oracle Academy Use Only. Volume II Student Guide. D64258GC10 Edition 1.0 January 2010 D65028 D64258GC10 Edition 1.0 January 2010 D65028 Oracle Database: SQL Fundamentals I Volume II Student Guide Authors Salome Clement Brian Pottle Puja Singh Technical Contributors and Reviewers Anjulaponni Azhagulekshmi

More information

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH 2017 Institute of Aga Network Database LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece of

More information

THE INDIAN COMMUNITY SCHOOL, KUWAIT

THE INDIAN COMMUNITY SCHOOL, KUWAIT THE INDIAN COMMUNITY SCHOOL, KUWAIT SERIES : II MID TERM /FN/ 18-19 CODE : M 065 TIME ALLOWED : 2 HOURS NAME OF STUDENT : MAX. MARKS : 50 ROLL NO. :.. CLASS/SEC :.. NO. OF PAGES : 3 INFORMATICS PRACTICES

More information

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement Chapter 4 Basic SQL Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured Query Language Statements for data definitions, queries,

More information

SQL. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

SQL. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior SQL Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior 1 DDL 2 DATA TYPES All columns must have a data type. The most common data types in SQL are: Alphanumeric: Fixed length:

More information

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value Databases - 3, Cartesian Product and Join is a value that we use when Something will never have a value Something will have a value in the future Something had a value but doesn t at the moment is a reserved

More information

Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO

Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO INSERT INTO DEPT VALUES(4, 'Prog','MO'); The result

More information

Relational Database Management Systems for Epidemiologists: SQL Part I

Relational Database Management Systems for Epidemiologists: SQL Part I Relational Database Management Systems for Epidemiologists: SQL Part I Outline SQL Basics Retrieving Data from a Table Operators and Functions What is SQL? SQL is the standard programming language to create,

More information

Programming Languages

Programming Languages Programming Languages Chapter 19 - Continuations Dr. Philip Cannata 1 Exceptions (define (f n) (let/cc esc (/ 1 (if (zero? n) (esc 1) n)))) > (f 0) 1 > (f 2) 1/2 > (f 1) 1 > Dr. Philip Cannata 2 Exceptions

More information

Oracle Database 10g: SQL Fundamentals I

Oracle Database 10g: SQL Fundamentals I Oracle Database 10g: SQL Fundamentals I Electronic Presentation D17108GC11 Production 1.1 August 2004 D39769 Author Nancy Greenberg Technical Contributors and Reviewers Wayne Abbott Christian Bauwens Perry

More information

Overview of PL/SQL. About PL/SQL. PL/SQL Environment. Benefits of PL/SQL. Integration

Overview of PL/SQL. About PL/SQL. PL/SQL Environment. Benefits of PL/SQL. Integration About PL/ Overview of PL/ PL/ is an extension to with design features of programming languages. Data manipulation and query statements of are included within procedural units of code. PL/ Environment Benefits

More information

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Link full download: https://testbankservice.com/download/test-bank-fordatabase-processing-fundamentals-design-and-implementation-13th-edition-bykroenke

More information

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version :

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version : Oracle 1Z1-051 Oracle Database 11g SQL Fundamentals I Download Full Version : https://killexams.com/pass4sure/exam-detail/1z1-051 QUESTION: 238 You need to perform these tasks: - Create and assign a MANAGER

More information

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH Institute of Aga 2018 Microsoft SQL Server LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece

More information

Relational Database Management Systems Mar/Apr I. Section-A: 5 X 4 =20 Marks

Relational Database Management Systems Mar/Apr I. Section-A: 5 X 4 =20 Marks Relational Database Management Systems Mar/Apr 2015 1 I. Section-A: 5 X 4 =20 Marks 1. Database Database: Database is a collection of inter-related data which contains the information of an enterprise.

More information

Practical Workbook Database Management Systems

Practical Workbook Database Management Systems Practical Workbook Database Management Systems Name : Year : Batch : Roll No : Department: Third Edition Reviewed in 2014 Department of Computer & Information Systems Engineering NED University of Engineering

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL ORACLE UNIVERSITY CONTACT US: 00 9714 390 9000 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database

More information

Topic 8 Structured Query Language (SQL) : DML Part 2

Topic 8 Structured Query Language (SQL) : DML Part 2 FIT1004 Database Topic 8 Structured Query Language (SQL) : DML Part 2 Learning Objectives: Use SQL functions Manipulate sets of data Write subqueries Manipulate data in the database References: Rob, P.

More information

Informatics Practices (065) Sample Question Paper 1 Section A

Informatics Practices (065) Sample Question Paper 1 Section A Informatics Practices (065) Sample Question Paper 1 Note 1. This question paper is divided into sections. Section A consists 30 marks. 3. Section B and Section C are of 0 marks each. Answer the questions

More information

SQL functions fit into two broad categories: Data definition language Data manipulation language

SQL functions fit into two broad categories: Data definition language Data manipulation language Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 7 Beginning Structured Query Language (SQL) MDM NUR RAZIA BINTI MOHD SURADI 019-3932846 razia@unisel.edu.my

More information

Key Points. COSC 122 Computer Fluency. Databases. What is a database? Databases in the Real-World DBMS. Database System Approach

Key Points. COSC 122 Computer Fluency. Databases. What is a database? Databases in the Real-World DBMS. Database System Approach COSC 122 Computer Fluency Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) allow for easy storage and retrieval of large amounts of information. 2) Relational

More information

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations Show Only certain columns and rows from the join of Table A with Table B The implementation of table operations

More information

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-4 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 4 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA

More information

Data Manipulation Language (DML)

Data Manipulation Language (DML) In the name of Allah Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM 4113 DataBase Lab Lab # 3 Data Manipulation Language (DML) El-masry 2013 Objective To be familiar

More information

CSC Web Programming. Introduction to SQL

CSC Web Programming. Introduction to SQL CSC 242 - Web Programming Introduction to SQL SQL Statements Data Definition Language CREATE ALTER DROP Data Manipulation Language INSERT UPDATE DELETE Data Query Language SELECT SQL statements end with

More information

Sample Question Paper

Sample Question Paper Sample Question Paper Marks : 70 Time:3 Hour Q.1) Attempt any FIVE of the following. a) List any four applications of DBMS. b) State the four database users. c) Define normalization. Enlist its type. d)

More information

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries

More information

Chapter. Relational Database Concepts COPYRIGHTED MATERIAL

Chapter. Relational Database Concepts COPYRIGHTED MATERIAL Chapter Relational Database Concepts 1 COPYRIGHTED MATERIAL Every organization has data that needs to be collected, managed, and analyzed. A relational database fulfills these needs. Along with the powerful

More information

SQL. - single row functions - Database Design ( 데이터베이스설계 ) JUNG, Ki-Hyun ( 정기현 )

SQL. - single row functions - Database Design ( 데이터베이스설계 ) JUNG, Ki-Hyun ( 정기현 ) SQL Database Design ( 데이터베이스설계 ) - single row functions - JUNG, Ki-Hyun ( 정기현 ) 1 SQL Functions Input Function Output Function performs action that defined already before execution 2 Two Types of SQL Functions

More information

Relational Database Management Systems Oct I. Section-A: 5 X 4 =20 Marks

Relational Database Management Systems Oct I. Section-A: 5 X 4 =20 Marks Relational Database Management Systems Oct 2015 1 I. Section-A: 5 X 4 =20 Marks 1. Data Consistency Files and application programs are created by different programmers over a long period of time, the files

More information

Chapter-14 SQL COMMANDS

Chapter-14 SQL COMMANDS Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language

More information

Manipulating Data. Copyright 2004, Oracle. All rights reserved.

Manipulating Data. Copyright 2004, Oracle. All rights reserved. Manipulating Data Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe each data manipulation language (DML) statement

More information

Oracle Database 11g: SQL and PL/SQL Fundamentals

Oracle Database 11g: SQL and PL/SQL Fundamentals Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL

More information

@vmahawar. Agenda Topics Quiz Useful Links

@vmahawar. Agenda Topics Quiz Useful Links @vmahawar Agenda Topics Quiz Useful Links Agenda Introduction Stakeholders, data classification, Rows/Columns DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE CONSTRAINTS, DATA TYPES DML Data

More information

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data 1 Writing Basic SQL SELECT Statements Objectives 1-2 Capabilities of SQL SELECT Statements 1-3 Basic SELECT Statement 1-4 Selecting All Columns 1-5 Selecting Specific Columns 1-6 Writing SQL Statements

More information

Tables From Existing Tables

Tables From Existing Tables Creating Tables From Existing Tables After completing this module, you will be able to: Create a clone of an existing table. Create a new table from many tables using a SQL SELECT. Define your own table

More information

Downloaded from

Downloaded from Unit-III DATABASES MANAGEMENT SYSTEM AND SQL DBMS & Structured Query Language Chapter: 07 Basic Database concepts Data : Raw facts and figures which are useful to an organization. We cannot take decisions

More information

Relational Database Languages

Relational Database Languages 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

SELF TEST. List the Capabilities of SQL SELECT Statements

SELF TEST. List the Capabilities of SQL SELECT Statements 98 SELF TEST The following questions will help you measure your understanding of the material presented in this chapter. Read all the choices carefully because there might be more than one correct answer.

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

Comparison Operators. Selecting Rows with Conditional Restrictions

Comparison Operators. Selecting Rows with Conditional Restrictions Selecting Rows with Conditional Restrictions You have learnt, so far, how to list all the rows from a table using the SELECT command with the asterisk character as a wildcard. Of course, you might need

More information

Greenplum SQL Class Outline

Greenplum SQL Class Outline Greenplum SQL Class Outline The Basics of Greenplum SQL Introduction SELECT * (All Columns) in a Table Fully Qualifying a Database, Schema and Table SELECT Specific Columns in a Table Commas in the Front

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

COSC 122 Computer Fluency. Databases. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Databases. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Databases allow for easy storage and retrieval of large amounts of information.

More information

Unit 4. Scalar Functions and Arithmetic

Unit 4. Scalar Functions and Arithmetic Unit 4. Scalar Functions and Arithmetic What This Unit Is About Scalar functions can be used to manipulate column or expression values. This unit will discuss the format and syntax of basic scalar functions.

More information

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION. Subject- Informatics Practices

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION. Subject- Informatics Practices Grade- XI INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION Unit 1 Programming and Computational Thinking Chapter 1 Introduction to Computer Systems 1. What are the functions of computer? 2. What

More information

1Z0-007 ineroduction to oracle9l:sql

1Z0-007 ineroduction to oracle9l:sql ineroduction to oracle9l:sql Q&A DEMO Version Copyright (c) 2007 Chinatag LLC. All rights reserved. Important Note Please Read Carefully For demonstration purpose only, this free version Chinatag study

More information

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011 Introduction to SQL IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic syntax

More information

Oracle Syllabus Course code-r10605 SQL

Oracle Syllabus Course code-r10605 SQL Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic

More information

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION Grade- XI COMPUTER SCIENCE Unit I Programming and Computational Thinking 1. What are the functions of computer? 2. Briefly explain the basic architecture

More information

A. It executes successfully and displays rows in the descending order of PROMO_CATEGORY.

A. It executes successfully and displays rows in the descending order of PROMO_CATEGORY. Volume: 75 Questions Question No: 1 Evaluate the following SQL statement: Which statement is true regarding the outcome of the above query? A. It executes successfully and displays rows in the descending

More information

DB2 SQL Class Outline

DB2 SQL Class Outline DB2 SQL Class Outline The Basics of SQL Introduction Finding Your Current Schema Setting Your Default SCHEMA SELECT * (All Columns) in a Table SELECT Specific Columns in a Table Commas in the Front or

More information

CS Reading Packet: "Views, and Simple Reports - Part 1"

CS Reading Packet: Views, and Simple Reports - Part 1 CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" p. 1 Sources: CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" * Oracle9i Programming: A Primer, Rajshekhar Sunderraman, Addison

More information

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview RDBMS Using Oracle BIT-4 Lecture Week 3 Lecture Overview Creating Tables, Valid and Invalid table names Copying data between tables Character and Varchar2 DataType Size Define Variables in SQL NVL and

More information