Lab 09: Advanced SQL

Size: px
Start display at page:

Download "Lab 09: Advanced SQL"

Transcription

1 CIS395 - BMCC - Fall /14/2018 Lab 09: Advanced SQL 1- Copy and paste the following code into your SQL Editor, then execute it. This code will create the Students table. CREATE TABLE Students ( studentno VARCHAR(4), fname VARCHAR(20), lname VARCHAR(20), department VARCHAR(50), score NUMBER, PRIMARY KEY (studentno) ); 2- Run the following statements to insert sample data into the Students table. INSERT INTO Students VALUES('S288','Lucy','Treston','Mathematics',78); INSERT INTO Students VALUES('S293','Raul','Upthegrove','Mathematics',86); INSERT INTO Students VALUES('S305','Ligia','Reiber','Biology',58); INSERT INTO Students VALUES('S314','Kattie','Vonasek','Computer Science',82); INSERT INTO Students VALUES('S326','Adelina','Nabours','Physics',81); INSERT INTO Students VALUES('S337','Dulce','Labreche','Computer Science',65); INSERT INTO Students VALUES('S349','Samira','Heintzman','Mathematics',77); INSERT INTO Students VALUES('S407','Arthur','Farrow','Physics',92); INSERT INTO Students VALUES('S255','Carey','Dopico','Biology',64); INSERT INTO Students VALUES('S283','Noah','Kalafatis','Computer Science',82); INSERT INTO Students VALUES('S361','Kasandra','Semidey','Physics',93); INSERT INTO Students VALUES('S404','Teddy','Pedrozo','Computer Science',74); 3- Execute the following PL/SQL block that incorporates variables declared with explicit data types. v_fname VARCHAR(20); v_lname VARCHAR(20); v_fname := 'Lucy'; v_lname := 'Treston';

2 4- Execute the following PL/SQL block that incorporates variables declared using same types as columns from a specified table. v_fname Students.fName%TYPE; v_lname Students.lName%TYPE; v_fname := 'Arthur'; v_lname := 'Farrow'; 5- Execute the following PL/SQL block that declares and initializes variables at the declaration part. v_fname VARCHAR(20) := 'Kasandra'; v_lname VARCHAR(20) := 'Semidey'; 6- Execute the following PL/SQL block that incorporates variables assigned using the result of an SQL statement. v_fname VARCHAR(20); v_lname VARCHAR(20); SELECT fname,lname INTO v_fname,v_lname FROM Students WHERE studentno = 'S404'; 7- Execute the following PL/SQL block that incorporates a variable assigned using the result of an SQL statement with an aggregate function. v_total NUMBER; SELECT COUNT(*) INTO v_total FROM Students WHERE department = 'Physics'; DBMS_OUTPUT.PUT_LINE('Number of physics students is: ' v_total);

3 8- Execute the following PL/SQL block that incorporates a variable with multiple values. v_cookies NUMBER := 2; v_calories_per_cookie NUMBER := 300; DBMS_OUTPUT.PUT_LINE('I ate ' v_cookies ' cookies with ' v_cookies * v_calories_per_cookie ' calories.'); v_cookies := 3; DBMS_OUTPUT.PUT_LINE('I really ate ' v_cookies ' cookies with ' v_cookies * v_calories_per_cookie ' calories.'); v_cookies := v_cookies + 5; DBMS_OUTPUT.PUT_LINE('The truth is, I actually ate ' v_cookies ' cookies with ' v_cookies * v_calories_per_cookie ' calories.'); 9- Execute the following PL/SQL block that inserts a new record into the Students table. v_studentno Students.studentNo%TYPE; v_fname Students.fName%TYPE; v_lname Students.lName%TYPE; v_dpt Students.department%TYPE; vscore Students.score%TYPE; v_studentno := 'S236'; v_fname := 'Eden'; v_lname := 'Jayson'; v_dpt := 'Biology'; vscore := 86; INSERT INTO Students VALUES(v_studentNo,v_fName,v_lName,v_dpt,vscore); DBMS_OUTPUT.PUT_LINE('The Student ' v_studentno ' is added.'); 10- Check the content of the Students table and make sure the record from the previous task was added. SELECT * FROM Students;

4 Consider the example where two numeric values are stored in the variables v_num1 and v_num2. The following PL/SQL block arranges their values so that the smaller value is always stored in v_num1 and the larger value is always stored in v_num2. v_num1 NUMBER := 5; v_num2 NUMBER := 3; v_temp NUMBER; IF v_num1 > v_num2 THEN v_temp := v_num1; v_num1 := v_num2; v_num2 := v_temp; END IF; DBMS_OUTPUT.PUT_LINE('v_num1 = ' v_num1); DBMS_OUTPUT.PUT_LINE('v_num2 = ' v_num2); 11- Test the above code using different values of v_num1 and v_num Execute the following PL/SQL block that uses the IF-THEN-ELSE statement to choose between two mutually exclusive actions. v_num NUMBER := -25; IF v_num < 0 THEN DBMS_OUTPUT.PUT_LINE(v_num ' is a negative number.'); ELSE DBMS_OUTPUT.PUT_LINE(v_num ' is a positive number.'); END IF; DBMS_OUTPUT.PUT_LINE('Done.'); 13- Test the above code using different positive and negative values of v_num. 14- Execute the following PL/SQL block that uses the CASE statement to determine which group of actions to take based on the value of the operand v_dpt.

5 v_studentno VARCHAR(4) := 'S288'; v_dpt VARCHAR(50); SELECT department INTO v_dpt FROM Students WHERE studentno = v_studentno; CASE v_dpt WHEN 'Mathematics' THEN DBMS_OUTPUT.PUT_LINE('The student ' v_studentno ' is a mathematician.'); WHEN 'Biology' THEN DBMS_OUTPUT.PUT_LINE('The student ' v_studentno ' is a biologist.'); WHEN 'Physics' THEN DBMS_OUTPUT.PUT_LINE('The student ' v_studentno ' is a physician.'); ELSE DBMS_OUTPUT.PUT_LINE('The student ' v_studentno ' is a computer scientist.'); END CASE; DBMS_OUTPUT.PUT_LINE ('Student has been identified!'); 15- Test the above code using the following student numbers: S305, S326, and S Execute the following PL/SQL block that uses the CASE statement to provide the same output as Task14 but without checking the value of an operand. This statement checks search conditions. v_studentno VARCHAR(4) := 'S288'; v_dpt VARCHAR(50); SELECT department INTO v_dpt FROM Students WHERE studentno = v_studentno; CASE WHEN v_dpt = 'Mathematics' THEN DBMS_OUTPUT.PUT_LINE( 'The student ' v_studentno ' is a mathematician.'); WHEN v_dpt = 'Biology' THEN DBMS_OUTPUT.PUT_LINE( 'The student ' v_studentno ' is a biologist.'); WHEN v_dpt = 'Physics' THEN DBMS_OUTPUT.PUT_LINE( 'The student ' v_studentno ' is a physician.'); ELSE DBMS_OUTPUT.PUT_LINE('The student ' v_studentno ' is a computer scientist.'); END CASE; DBMS_OUTPUT.PUT_LINE ('Student has been identified!');

6 17- Similarly, type and execute a PL/SQL block that displays the following messages based on the score value of the student v_studentno. If the score is greater than or equal to 90, display: "The student v_studentno with the score v_score got A grade." If the score is greater than or equal to 80 and less than 90, display: "The student v_studentno with the score v_score got B grade." If the score is greater than or equal to 70 and less than 80, display: "The student v_studentno with the score v_score got C grade." If the score is greater than or equal to 60 and less than 70, display: "The student v_studentno with the score v_score got D grade." Otherwise, display: "The student v_studentno with the score v_score got F grade." Note: v_studentno and v_score, in the displayed messages, should be replaced by the student number and the score value, respectively. 18- Test the PL/SQL block you created in Task17 using the following student numbers: S305, S326, S337, and S Using an IF-THEN-ELSE statement, type and execute a PL/SQL block that displays the following messages based on the score value of the v_studentno. If the score is greater than or equal to 60, display: "The student v_studentno with the score v_score has passed." If the score is less than 60, display: "The student v_studentno with the score v_score has failed." Note: v_studentno and v_score, in the displayed messages, should be replaced by the student number and the score value, respectively. 20- Test the PL/SQL block you created in Task19 using the following student numbers: S305 and S255.

SQL: Data Sub Language

SQL: Data Sub Language SQL: Data Sub Language SQL used with regular Language SQL used to deal with the database Stores/Updates data Retrieves data Regular language deals with other aspects of the program: Makes beautiful web

More information

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL Trapping Oracle Server Exceptions 1 Copyright 2013, Oracle and/or its affiliates. All rights Objectives This lesson covers the following objectives: Describe and provide

More information

Lab 09: Advanced SQL

Lab 09: Advanced SQL CIS395 - BMCC - Spring 2018 04/25/2018 Lab 09: Advanced SQL A - Use Simple Loops with EXIT Conditions In this exercise, you use the EXIT condition to terminate a simple loop, and a special variable, v_counter,

More information

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017 Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

More information

Control Structures in Java if-else and switch

Control Structures in Java if-else and switch Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2016 February 2, 2016 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions

More information

SQL was defined in the late 60 s, early 70 s by the System R research group at IBM.

SQL was defined in the late 60 s, early 70 s by the System R research group at IBM. Introduction to SQL: SQL was defined in the late 60 s, early 70 s by the System R research group at IBM. Large numbers of products are available based on SQL with minor/major changes in syntax. ORACLE

More information

SQL CSCI 201 Principles of Software Development

SQL CSCI 201 Principles of Software Development SQL CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Outline SELECT Statements Try It USC CSCI 201L SELECT Statements SELECT statements are probably the most commonly

More information

Lab Assignment 9 CIS 208A PL/SQL Programming and SQL

Lab Assignment 9 CIS 208A PL/SQL Programming and SQL Lab Assignment 9 CIS 208A PL/SQL Programming and SQL Section 9-1, Exercise #2, 3 2. Function full_name: A. Create a function called full_name. Pass two parameters to the function: an employee s last name

More information

Guess Paper Class XII Subject Informatics Practices TIME : 1½ HRS. M.M. : 50

Guess Paper Class XII Subject Informatics Practices TIME : 1½ HRS. M.M. : 50 Guess Paper 2009-10 Class XII Subject Informatics Practices Answer the following questions 1. Explain the following terms: 2x5=10 a) Shareware b) PHP c) UNICODE d) GNU e) FLOSS 2 Explain the following

More information

Introduction to Computing Systems Fall Lab # 3

Introduction to Computing Systems Fall Lab # 3 EE 1301 UMN Introduction to Computing Systems Fall 2013 Lab # 3 Collaboration is encouraged. You may discuss the problems with other students, but you must write up your own solutions, including all your

More information

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Table of Contents. PDF created with FinePrint pdffactory Pro trial version Table of Contents Course Description The SQL Course covers relational database principles and Oracle concepts, writing basic SQL statements, restricting and sorting data, and using single-row functions.

More information

Procedural Language Structured Query Language (PL/SQL)

Procedural Language Structured Query Language (PL/SQL) The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 7 Procedural Language Structured Query Language (PL/SQL) Eng. Ibraheem Lubbad Structured

More information

OVERVIEW OF THE TYPES OF PL/SQL BLOCKS:

OVERVIEW OF THE TYPES OF PL/SQL BLOCKS: OVERVIEW OF THE TYPES OF PL/SQL BLOCKS: The P/L SQL blocks can be divided into two broad categories: Anonymous Block: The anonymous block is the simplest unit in PL/SQL. It is called anonymous block because

More information

2 PL/SQL - fundamentals Variables and Constants Operators SQL in PL/SQL Control structures... 7

2 PL/SQL - fundamentals Variables and Constants Operators SQL in PL/SQL Control structures... 7 Table of Contents Spis treści 1 Introduction 1 2 PLSQL - fundamentals 1 2.1 Variables and Constants............................ 2 2.2 Operators.................................... 5 2.3 SQL in PLSQL.................................

More information

Control Structures in Java if-else and switch

Control Structures in Java if-else and switch Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2017 January 23, 2017 Lecture 4CGS 3416 Spring 2017 Selection January 23, 2017 1 / 26 Control Flow Control flow refers to the specification

More information

Principles of Data Management

Principles of Data Management Principles of Data Management Alvin Lin August 2018 - December 2018 Structured Query Language Structured Query Language (SQL) was created at IBM in the 80s: SQL-86 (first standard) SQL-89 SQL-92 (what

More information

Lecture 5 Tao Wang 1

Lecture 5 Tao Wang 1 Lecture 5 Tao Wang 1 Objectives In this chapter, you will learn about: Selection criteria Relational operators Logical operators The if-else statement Nested if statements C++ for Engineers and Scientists,

More information

ITDUMPS QUESTION & ANSWER. Accurate study guides, High passing rate! IT dumps provides update free of charge in one year!

ITDUMPS QUESTION & ANSWER. Accurate study guides, High passing rate! IT dumps provides update free of charge in one year! ITDUMPS QUESTION & ANSWER Accurate study guides, High passing rate! IT dumps provides update free of charge in one year! HTTP://WWW.ITDUMPS.COM Exam : 1Z0-144 Title : Oracle Database 11g: Program with

More information

QUIZ: What value is stored in a after this

QUIZ: What value is stored in a after this QUIZ: What value is stored in a after this statement is executed? Why? a = 23/7; QUIZ evaluates to 16. Lesson 4 Statements, Expressions, Operators Statement = complete instruction that directs the computer

More information

Full file at

Full file at ch02 True/False Indicate whether the statement is true or false. 1. The term anonymous blocks refers to blocks of code that are not stored for reuse and do not exist after being executed. 2. The only required

More information

BRANCHING if-else statements

BRANCHING if-else statements BRANCHING if-else statements Conditional Statements A conditional statement lets us choose which statement t t will be executed next Therefore they are sometimes called selection statements Conditional

More information

Procedure & Function

Procedure & Function The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 8 Procedure & Function Eng. Ibraheem Lubbad PL/SQL has two types of subprograms called procedures

More information

RDBMS - PL SQL - Topic 5 - MSBTE QUESTIONS AND ANSWERS

RDBMS - PL SQL - Topic 5 - MSBTE QUESTIONS AND ANSWERS RDBMS - PL SQL - Topic 5 - MSBTE QUESTIONS AND ANSWERS SUMMER 2017 Q. Describe Exception handling. Explain with example. 4 Marks Exception Handling: Exception is nothing but an error. Exception can be

More information

CSCB20 Week 4. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 4. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 4 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Last Week Intro to SQL and MySQL Mapping Relational Algebra to SQL queries Focused on queries to start

More information

Database Application Development Oracle PL/SQL, part 2. CS430/630 Lecture 18b

Database Application Development Oracle PL/SQL, part 2. CS430/630 Lecture 18b Database Application Development Oracle PL/SQL, part 2 CS430/630 Lecture 18b Murach Chapter 14 How to manage transactions and locking PL/SQL, C14 2014, Mike Murach & Associates, Inc. Slide 2 Objectives

More information

CS 141, Introduction to Computer Science Fall Midterm Exam

CS 141, Introduction to Computer Science Fall Midterm Exam CS 141, Introduction to Computer Science Fall 2006 Midterm Exam Name: Student ID: 1 (12 points) Data Types Where possible give 3 examples of possible values for each of the following data types. Use proper

More information

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office Access 2010 Chapter 2: Relational Databases and Multi-Table Queries 1 Objectives Design data Create tables Understand table relationships Share data with Excel Establish table

More information

Databases CSCI 201 Principles of Software Development

Databases CSCI 201 Principles of Software Development Databases CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Outline Databases SQL Try It! USC CSCI 201L Databases Database systems store data and provide a means

More information

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL 2-7 Objectives This lesson covers the following objectives: List examples of good programming practices Accurately insert comments into PL/SQL code Create PL/SQL code that

More information

Oracle PL/SQL Best Practices Part 1. John Mullins

Oracle PL/SQL Best Practices Part 1. John Mullins Oracle PLSQL Best Practices Part 1 John Mullins jmullins@themisinc.com www.themisinc.com www.themisinc.comwebinars Presenter John Mullins Themis Inc. (jmullins@themisinc.com) 30+ years of Oracle experience

More information

Decision Structures. Selection. Selection options (in Java) Plain if s (3 variations) Each action could be any of: if else (3 variations)

Decision Structures. Selection. Selection options (in Java) Plain if s (3 variations) Each action could be any of: if else (3 variations) Decision Structures if, if/ conditions Selection DECISION: determine which of 2 paths to follow (1+ statements in each path) CS1110 - Kaminski (ELSE path optional) 2 Selection options (in Java) Plain if

More information

Assertions, Views, and Programming. CS157A Chris Pollett Oct. 31, 2005.

Assertions, Views, and Programming. CS157A Chris Pollett Oct. 31, 2005. Assertions, Views, and Programming CS157A Chris Pollett Oct. 31, 2005. Outline Assertions Views Database Programming Assertions It is useful to be able to specify general constraints in SQL -- i.e., other

More information

A: if no run time errors or exceptions B: (-1 point) If you got one or more run time error or exception but the application is still running.

A: if no run time errors or exceptions B: (-1 point) If you got one or more run time error or exception but the application is still running. Computer Programming Project Evaluation - Summer 2018 Criteria for grading and Grading 14 points in total - Minimum to pass 8, according to 5 dimensions: 1) Functionality (Coverage of the requirements)

More information

Lesson 38: Conditionals #2 (W11D3)

Lesson 38: Conditionals #2 (W11D3) Lesson 38: Conditionals #2 (W11D3) Balboa High School Michael Ferraro October 28, 2015 1 / 61 Do Now In Lesson38/DoNow.java, write a method called isdivisiblebyfour() that takes an int returns the boolean

More information

Database Systems Laboratory 14

Database Systems Laboratory 14 Database Systems Laboratory 14 a School of Computer Engineering, KIIT University 14.1 a 1 2 a 14.2 These are similar in structure to a row in a database table A record consists of components of any scalar,

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

Repetition Algorithms

Repetition Algorithms Repetition Algorithms Repetition Allows a program to execute a set of instructions over and over. The term loop is a synonym for a repetition statement. A Repetition Example Suppose that you have been

More information

II (The Sequel) We will use the following database as an example throughout this lab, found in students.db.

II (The Sequel) We will use the following database as an example throughout this lab, found in students.db. 2 SQL II (The Sequel) Lab Objective: Since SQL databases contain multiple tables, retrieving information about the data can be complicated. In this lab we discuss joins, grouping, and other advanced SQL

More information

BSc (Hons) Computer Science with Network Security. Examinations for / Semester1

BSc (Hons) Computer Science with Network Security. Examinations for / Semester1 BSc (Hons) Computer Science with Network Security Cohort: BCNS/14/FT Examinations for 2014-2015 / Semester1 MODULE: DATABASE DESIGN MODULE CODE: DBT 1111C Duration: 2 Hours 30 Mins Instructions to Candidates:

More information

MATLAB. Devon Cormack and James Staley

MATLAB. Devon Cormack and James Staley MATLAB Devon Cormack and James Staley MATrix LABoratory Originally developed in 1970s as a FORTRAN wrapper, later rewritten in C Designed for the purpose of high-level numerical computation, visualization,

More information

PL/SQL is an Oracle proprietary, procedural, 3GL programming language. (*) PL/SQL is an Oracle proprietary, procedural, 4GL programming language.

PL/SQL is an Oracle proprietary, procedural, 3GL programming language. (*) PL/SQL is an Oracle proprietary, procedural, 4GL programming language. Section 1 (Answer all questions in this section) Quiz: Introduction to PL/SQL 1. PL/SQL stands for: Processing Language for SQL. Procedural Language extension for SQL. (*) Primary Language for SQL. Proprietary

More information

Lab #2 CIS 208A - PL/SQL Course

Lab #2 CIS 208A - PL/SQL Course Lab #2 CIS 208A - PL/SQL Course Section 2-1, #2, 5 2.. Identify valid and invalid variable declaration and initialization: number_of_copies PLS_INTEGER; printer_name CONSTANT VARCHAR2(10); deliver_to VARCHAR2(10):=Johnson;

More information

LAB 12: ARRAYS (ONE DIMINSION)

LAB 12: ARRAYS (ONE DIMINSION) Statement Purpose: The purpose of this Lab. is to practically familiarize student with the concept of array and related operations performed on array. Activity Outcomes: Student will understand the concept

More information

CS2300: File Structures and Introduction to Database Systems

CS2300: File Structures and Introduction to Database Systems CS2300: File Structures and Introduction to Database Systems Lecture 14: SQL Doug McGeehan From Theory to Practice The Entity-Relationship Model: a convenient way of representing the world. The Relational

More information

Using OpenESQL to Map COBOL to DBMS Data Types

Using OpenESQL to Map COBOL to DBMS Data Types There is an easy way in Net Express to determine the correct mapping of COBOL data types to the appropriate DBMS's data types. This issue arises frequently and by using the OpenESQL assistant tool the

More information

Making Decisions In Python

Making Decisions In Python Making Decisions In Python In this section of notes you will learn how to have your programs choose between alternative courses of action. Decision Making Is All About Choices My next vacation? Images:

More information

Section I : Section II : Question 1. Question 2. Question 3.

Section I : Section II : Question 1. Question 2. Question 3. Computer Science, 60-415 Midterm Examiner: Ritu Chaturvedi Date: Oct. 27 th, 2011 Student Name: Student Number: INSTRUCTIONS (Please Read Carefully) Examination Period is 1 hour and 15 minutes Answer all

More information

EGC221: Digital Logic Lab

EGC221: Digital Logic Lab EGC221: Digital Logic Lab Experiment #7 Arithmetic Logic Unit (ALU) Schematic Implementation Student s Name: Student s Name: Reg. no.: Reg. no.: Semester: Spring 2017 Date: 04 April 2017 Assessment: Assessment

More information

Lecture 4: Conditionals

Lecture 4: Conditionals Lecture 4: Conditionals Building Java Programs: A Back to Basics Approach by Stuart Reges and Marty Stepp Copyright (c) Pearson 2013. All rights reserved. Type boolean Type boolean boolean: A logical type

More information

Oracle PLSQL. Course Summary. Duration. Objectives

Oracle PLSQL. Course Summary. Duration. Objectives Oracle PLSQL Course Summary Use conditional compilation to customize the functionality in a PL/SQL application without removing any source code Design PL/SQL packages to group related constructs Create

More information

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL 15-4 Objectives This lesson covers the following objectives: Describe the benefits of obfuscated PL/SQL source code Use the DBMS_DDL.CREATE_WRAPPED server-supplied procedure

More information

IBM DB2 9.5 SQL Procedure Developer. Download Full Version :

IBM DB2 9.5 SQL Procedure Developer. Download Full Version : IBM 000-735 DB2 9.5 SQL Procedure Developer Download Full Version : http://killexams.com/pass4sure/exam-detail/000-735 QUESTION: 93 CREATE FUNCTION dept_employees (deptno CHAR(3)) RETURNS TABLE (empno

More information

SQL Retrieving Data from Multiple Tables

SQL Retrieving Data from Multiple Tables The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 5 SQL Retrieving Data from Multiple Tables Eng. Ibraheem Lubbad An SQL JOIN clause is used

More information

Security Considerations for SYS_REFCURSOR use in Oracle PL/SQL Applications. 1st July 2011 David Litchfield

Security Considerations for SYS_REFCURSOR use in Oracle PL/SQL Applications. 1st July 2011 David Litchfield Security Considerations for SYS_REFCURSOR use in Oracle PL/SQL Applications 1st July 2011 David Litchfield In databases, cursors can be considered as a handle to an SQL query and its result set. Oracle

More information

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

Oracle 11g Virtual Column Inderpal S. Johal. Inderpal S. Johal, Data Softech Inc.

Oracle 11g Virtual Column   Inderpal S. Johal. Inderpal S. Johal, Data Softech Inc. ORACLE 11G VIRTUAL COLUMN Inderpal S. Johal, Data Softech Inc. INTRODUCTION In Oracle 11g has allowed database Tables to have virtual columns. These virtual columns can be more specifically called as derived

More information

Assignment 6. This lab should be performed under the Oracle Linux VM provided in the course.

Assignment 6. This lab should be performed under the Oracle Linux VM provided in the course. Assignment 6 This assignment includes hands-on exercises in the Oracle VM. It has two Parts. Part 1 is SQL Injection Lab and Part 2 is Encryption Lab. Deliverables You will be submitting evidence that

More information

Database Application Development

Database Application Development Database Application Development Chapter 6 PSM (Stored Procedures) 1 Stored Procedures What is a stored procedure: SQL allows you to define procedures and functions and store in the DB server Program executed

More information

LAB 4.1 Relational Operators and the if Statement

LAB 4.1 Relational Operators and the if Statement LAB 4.1 Relational Operators and the if Statement // This program tests whether or not an initialized value of num2 // is equal to a value of num1 input by the user. int main( ) int num1, // num1 is not

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012 University of Illinois at Chicago Department of Computer Science Final Examination CS 151 Mathematical Foundations of Computer Science Fall 2012 Thursday, October 18, 2012 Name: Email: Print your name

More information

Spring 2013 International Comparisons

Spring 2013 International Comparisons Spring 0 International Comparisons The data presented are overall means and standard deviations by grade level and content areas, sorted by regional associations. This summary report is produced twice

More information

(a) State the differences between SQL and PL/SQL. 2 (b) Differentiate between Cursors and Triggers. 2

(a) State the differences between SQL and PL/SQL. 2 (b) Differentiate between Cursors and Triggers. 2 Informatics Practices (065) Sample Question Paper 3 Note 1. This question paper is divided into three sections.. All questions are compulsory. 3. Section A consists of 30 marks.. Section B and Section

More information

Robotics II. Module 2: Application of Data Programming Blocks

Robotics II. Module 2: Application of Data Programming Blocks Robotics II Module 2: Application of Data Programming Blocks PREPARED BY Academic Services Unit December 2011 Applied Technology High Schools, 2011 Module 2: Application of Data Programming Blocks Module

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational

More information

PL/SQL is a combination of SQL along with the procedural features of programming languages.

PL/SQL is a combination of SQL along with the procedural features of programming languages. (24 Marks) 5.1 What is PLSQL? PLSQL stands for Procedural Language extension of SQL. PLSQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Ahmed Abumarasa Database Lab Lab 2 Database Table Introduction: The previous

More information

Session 1 - Active Databases (1/3)

Session 1 - Active Databases (1/3) INFO-H-415 - Advanced Databes Session 1 - Active Databes (1/3) Consider the following databe schema: Professor ProfNo Name Laboratory PhDStudent StudentNo Name Laboratory Supervisor Course CourseNo Title

More information

Topic 3 Object Relational Database

Topic 3 Object Relational Database Topic 3 Object Relational Database Limitation of Relational Data Model Uniformity Large number of similarly structure data Record orientation Basic data consists of fixed length records Small data items

More information

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL 2-6 Objectives This lesson covers the following objectives: Understand the scope and visibility of variables Write nested blocks and qualify variables with labels Describe

More information

SAGE Computing Services. The SQL and PL/SQL Results Cache. Is it a Dream Come True or Your Latest Nightmare?

SAGE Computing Services. The SQL and PL/SQL Results Cache. Is it a Dream Come True or Your Latest Nightmare? SAGE Computing Services Customised Oracle Training Workshops and Consulting The SQL and PL/SQL Results Cache Is it a Dream Come True or Your Latest Nightmare? Penny Cookson Managing Director penny@sagecomputing.com.au

More information

PL/SQL MOCK TEST PL/SQL MOCK TEST IV

PL/SQL MOCK TEST PL/SQL MOCK TEST IV http://www.tutorialspoint.com PL/SQL MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to PL/SQL. You can download these sample mock tests at your local

More information

SEF DATABASE FOUNDATION ON ORACLE COURSE CURRICULUM

SEF DATABASE FOUNDATION ON ORACLE COURSE CURRICULUM On a Mission to Transform Talent SEF DATABASE FOUNDATION ON ORACLE COURSE CURRICULUM Table of Contents Module 1: Introduction to Linux & RDBMS (Duration: 1 Week)...2 Module 2: Oracle SQL (Duration: 3 Weeks)...3

More information

Decisions, Decisions, Decisions. GEEN163 Introduction to Computer Programming

Decisions, Decisions, Decisions. GEEN163 Introduction to Computer Programming Decisions, Decisions, Decisions GEEN163 Introduction to Computer Programming You ve got to be very careful if you don t know where you are going, because you might not get there. Yogi Berra TuringsCraft

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

Introduction to SQL/PLSQL Accelerated Ed 2

Introduction to SQL/PLSQL Accelerated Ed 2 Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Introduction to SQL/PLSQL Accelerated Ed 2 Duration: 5 Days What you will learn This Introduction to SQL/PLSQL Accelerated course

More information

Computer Science Lab Exercise 1

Computer Science Lab Exercise 1 1 of 10 Computer Science 127 - Lab Exercise 1 Introduction to Excel User-Defined Functions (pdf) During this lab you will experiment with creating Excel user-defined functions (UDFs). Background We use

More information

Lecture Transcript While and Do While Statements in C++

Lecture Transcript While and Do While Statements in C++ Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some

More information

Relational Databases. Relational Databases. Extended Functional view of Information Manager. e.g. Schema & Example instance of student Relation

Relational Databases. Relational Databases. Extended Functional view of Information Manager. e.g. Schema & Example instance of student Relation Relational Databases Relational Databases 1 Relational Model of Data 2 Relational Algebra (and connection to Datalog) Relational database: a set of relations/tables Relation schema : specifies name of

More information

Getting Started with SQL

Getting Started with SQL Getting Started with SQL TAMÁS BUDAVÁRI AUGUST 2016 Databases are easy: they consist of tables, which in turn have columns just like the files with which you are probably used to working. The difference

More information

Oracle Development - Part III: Coding Standards

Oracle Development - Part III: Coding Standards By Cheetah Solutions Editor s Note: In this final of a three-white-paper series on Oracle Custom Development, Cheetah Solutions tackles the issue of coding standards. In their concluding white paper, Cheetah

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

Introduction to Database Systems CSE 344

Introduction to Database Systems CSE 344 Introduction to Database Systems CSE 344 Lecture 10: Basics of Data Storage and Indexes 1 Student ID fname lname Data Storage 10 Tom Hanks DBMSs store data in files Most common organization is row-wise

More information

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement Last Time Let s all Repeat Together 10/3/05 CS150 Introduction to Computer Science 1 1 We covered o Counter and sentinel controlled loops o Formatting output Today we will o Type casting o Top-down, stepwise

More information

COS 109 Final Exam, Fall 2016

COS 109 Final Exam, Fall 2016 COS 109 Final Exam, Fall 2016 January 22, 2017 3 hours 180 points total Please PRINT your name here Honor Pledge: I pledge my honor that I have not violated the Honor Code during this examination. Please

More information

Discovering the Power of Excel PowerPivot Data Analytic Expressions (DAX)

Discovering the Power of Excel PowerPivot Data Analytic Expressions (DAX) Discovering the Power of Excel 2010-2013 PowerPivot Data Analytic Expressions (DAX) 55108; 2 Days, Instructor-led Course Description This course is intended to expose you to PowerPivot Data Analytic Expressions

More information

PL/SQL-TYCS. The 'Hello World' Example

PL/SQL-TYCS. The 'Hello World' Example PLSQL-TYCS In this chapter, we will discuss the Basic Syntax of PLSQL which is a block-structured language; this means that the PLSQL programs are divided and written in logical blocks of code. Each block

More information

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15 Customer Table CUSTOMER (CustomerNo, fname, lname, phone) CustomerNo Primary key, numeric, 4 digits Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character

More information

What is Flubaroo? Step 1: Create an Assignment

What is Flubaroo? Step 1: Create an Assignment What is Flubaroo? Flubaroo is free tool that helps you quickly grade multiple-choice or fill-in-blank assignments. It is more than just a grading tool, Flubaroo also: Computes average assignment score.

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

CSE303 Logic Design II Laboratory 01

CSE303 Logic Design II Laboratory 01 CSE303 Logic Design II Laboratory 01 # Student ID Student Name Grade (10) 1 Instructor signature 2 3 4 5 Delivery Date -1 / 15 - Experiment 01 (Half adder) Objectives In the first experiment, a half adder

More information

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of The SQL Query Language Data Definition Basic Query

More information

Practical Project Report

Practical Project Report Practical Project Report May 11, 2017 I. People: II. Roles: Effort in both coding PL/SQL and writing III. Introduction: The topic of my project is DB queries using Oracle PL/SQL. This is my first time

More information

If Control Construct

If Control Construct If Control Construct A mechanism for deciding whether an action should be taken JPC and JWD 2002 McGraw-Hill, Inc. 1 Boolean Algebra Logical expressions have the one of two values - true or false A rectangle

More information

Course Requirements. Prerequisites Miscellaneous

Course Requirements. Prerequisites Miscellaneous Course Requirements Prerequisites Miscellaneous Tests MidTerm and Final Count Equally Closed Book Cheat Sheets Limited number, 8.5 x 11 paper 40% of grade Harder for CS 550 students Internet or TTN: You

More information

Triggers- View-Sequence

Triggers- View-Sequence The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 9 Triggers- View-Sequence Eng. Ibraheem Lubbad Triggers: A trigger is a PL/SQL block or

More information

1.2. Pictorial and Tabular Methods in Descriptive Statistics

1.2. Pictorial and Tabular Methods in Descriptive Statistics 1.2. Pictorial and Tabular Methods in Descriptive Statistics Section Objectives. 1. Stem-and-Leaf displays. 2. Dotplots. 3. Histogram. Types of histogram shapes. Common notation. Sample size n : the number

More information

This chapter will show how to organize data and then construct appropriate graphs to represent the data in a concise, easy-to-understand form.

This chapter will show how to organize data and then construct appropriate graphs to represent the data in a concise, easy-to-understand form. CHAPTER 2 Frequency Distributions and Graphs Objectives Organize data using frequency distributions. Represent data in frequency distributions graphically using histograms, frequency polygons, and ogives.

More information

Database Systems CSci 4380 Midterm Exam #2 March 31, 2016 SOLUTIONS

Database Systems CSci 4380 Midterm Exam #2 March 31, 2016 SOLUTIONS Database Systems CSci 4380 Midterm Exam #2 March 31, 2016 SOLUTIONS Question 1. Write the following queries using SQL using the data model below. Elections(eid, year, type, state, party) Candidates(cname,

More information

Persistent Stored Modules (Stored Procedures) : PSM

Persistent Stored Modules (Stored Procedures) : PSM 1 Persistent Stored Modules (Stored Procedures) : PSM Stored Procedures What is stored procedure? SQL allows you to define procedures and functions and store them in the database server Executed by the

More information