...Exam Name: Exam Type: Exam Code: Oracle Database: SQL Fundamentals Oracle 1Z0-051 Total Questions 114 Question: 1 Which statement is true regarding the INTERSECT operator? A. It ignores NULL values. B. Reversing the order of the intersected tables alters the result. C. The names of columns in all SELECT statements must be identical. D. The number of columns and data types must be identical for all SELECT statements in the query. Answer: D Question: 2 Which three statements are true regarding the data types in Oracle Database 0g/11g? (Choose three.) A. Only one LONG column can be used per table. B. A TIMESTAMP data type column stores only time values with fractional seconds. C. The BLOB data type column is used to store binary data in an operating system file. D. The minimum column width that can be specified for a VARCHAR2 data type column is one. E. The value for a CHAR data type column is blank-padded to the maximum defined column width. Answer: A, D, E Question: 3 Examine the structure of the PROGRAMS table: Name Null? Type ---------- ------------- --------------PROG_ID NOT NULL NUMBER(3) PROG_COST NUMBER(8,2) START_DATE NOT NULL DATE END_DATE DATE Which two SQL statements would execute successfully? (Choose two.) A. SELECT NVL(ADD_MONTHS(END_DATE,1),SYSDATE) FROM programs; B. SELECT TO_DATE(NVL(SYSDATE-END_DATE,SYSDATE)) FROM programs; C. SELECT NVL(MONTHS_BETWEEN(start_date,end_date),'Ongoing') FROM programs; D. SELECT NVL(TO_CHAR(MONTHS_BETWEEN(start_date,end_date))...
Words: 11884 - Pages: 48
...result in poor performance. For each SQL statement, a database manager application must initiate a separate communication with DB2. To improve application performance, you can create stored procedures that run on your database server. A client application can then simply call the stored procedures to obtain results of the SQL statements that are contained in the procedure. Because the stored procedure runs the SQL statement on the server for you, database performance is improved. In addition, stored procedures can help to centralize business logic. If you make changes to a stored procedure, the changes are immediately available to all client applications that use it. Stored procedures are programs that have the following characteristics: • Contain procedural constructs with SQL statements • Are stored in databases and run on DB2 servers • Can be called by name by an application that is using SQL • Allow an application program to run in two parts: the application on the client and the stored procedure on the server The following figures show how two client applications access a database located on a database server. A client application that does not use stored procedures to access a database can require more network traffic. A client application that takes advantage of a stored procedure can help to reduce network traffic and the number of times the database is accessed. A typical stored procedure contains one or more SQL statements and some manipulative or...
Words: 2097 - Pages: 9
...SQL Cursor A SQL cursor is a private Oracle SQL working area. There are two types of SQL cursor: implicit or explicit cursor. The implicit cursor is used by Oracle server to test and parse the SQL statements and the explicit cursors are declared by the programmers. Using the implicit cursor, we can test the outcome of SQL statements in PL/SQL. For example, • SQL%ROWCOUNT, return the number of rows affected; • SQL%FOUND, a BOOLEAN attribute indicating whether the recent SQL statement matches to any row; • SQL%NOTFOUND, a BOOLEAN attribute indicating whether the recent SQL statement does not match to any row; • SQL%ISOPEN, a BOOLEAN attribute and always evaluated as FALSE immediately after the SQL statement is executed. To write the explicit cursor, please refer to the following example. Note that a cursor definition can array a number of arguments. For example, DECLARE CURSOR csr_ac (p_name VARCHAR2) IS SELECT empno, name, sal FROM employee WHERE name LIKE '%p_name%'; BEGIN FOR rec_ac IN csr_ac ('LE') LOOP DBMS_OUTPUT.PUT_LINE(rec_ac.empno || ' ' ||rec_ac.name || ' '||v_sal); END LOOP ; CLOSE csr_ac; END; / Another way of writing the above code, is to use the basic loop and the SQL%NOTFOUND cursor, as shown in the following. SQL> DECLARE 2 CURSOR csr_ac (p_name VARCHAR2) IS 3 SELECT empno, ename, sal 4 FROM emp 5 6 WHERE ename LIKE '%SMITH%'; 7 8 v_a emp.empno%TYPE; ...
Words: 2868 - Pages: 12
...Learning Team: Create Database, Table & Inserts Read and follow the instructions carefully and completely for submission of the Week 3 Learning Team Assignment. NOTE: This is a large assignment. Starting early in the week and giving your team time to post code for a review and assistance will help you prepare it accurately and completely. I encourage everyone to work on the assignment throughout the week and not wait until the day it is due to begin the work. Please see the Instructor Policies for Team Participation credit guidelines. REQUIRED: Coding Standards for this course are required. Please see the attached Coding Standards. CRITICAL Resource: The attached Errors Table is a resource for dealing with error messages and other potential obstacles you may encounter writing code. Optional: Read the Week 2 and 3 Handouts in the Recommended Learning Activities to assist with creating this assignment. Optional: Complete the Week 2 and 3 Learning Activity Tutorials in the Recommended Learning Activities. REQUIRED: Use the Kudler Chart of Accounts PROVIDED. Analyze the "PROVIDED" Chart of Accounts spreadsheet in order to decide how you will design the database. Plan your Data Dictionary (You will be submitting data dictionary with your final project submission, Week 5.) REQUIRED: Use the Data Dictionary Template attached to create the Data Dictionary for the Learning Team Assignment. REQUIRED: Follow the instructions in the provided...
Words: 1276 - Pages: 6
...DD1334 Databasteknik Laboration 1: SQL Basics Andreas Gustafsson, Hedvig Kjellström, Michael Minock and John Folkesson The purpose of Laboration 1 is to learn how to retrieve rmation stored in relational databases. You will learn 1) how to formulate SQL queries and understand how they apply to the schema and how they are executed; 2) how constraints effect insertions and deletions; 3) about the basics of view, transactions, indices and triggers. The recommended reading for Laboration 1 is that of Lectures 1-7 , particularly Chap 6-8. Laboration Come prepared to the review session! Only one try is allowed – if you fail, you are not allowed to try again until the next lab session. The review will take 10 minutes or less, so have all papers in order. To pass you should have Completed Task 1 with at least 9 of the 10 queries right, completed Task 2 and able to explain why certain actions give errors and other do not, also 8 of the 9 steps should be documented showing you executed them correctly, Task 3 the output file should show that the trigger works as it should. The grade is A if passed when the review when due. See the Lab Grading page in bilda contents for the due dates for the labs and the grading of late assignments. Laboration 1 is intended to take 30h to complete. Computing Environment In this assignment you will use Nestor 2.0. Nestor is KTH’s logic engine (computer) dedicated to hold the databases used in this and other similar courses. Nestor is aptly named after...
Words: 2303 - Pages: 10
...dwqwdlqkdmqwkldnqwkldnwkdnwqdldkwd Solutions To Workshop Exercises Chapter 1: SQL and Data 4 Chapter 2: SQL: The Basics 13 Chapter 3: The WHERE and ORDER BY Clauses 20 Chapter 4: Character, Number, and Miscellaneous Functions 27 Chapter 5: Date and Conversion Functions 42 Chapter 6: Aggregate Functions, GROUP BY and HAVING 57 Chapter 7: Equijoins 73 Chapter 8: Subqueries 108 Chapter 9: Set Operators 126 Chapter 10: Complex Joins 137 Chapter 11: Insert, Update, and Delete 164 Chapter 12: Create, Alter, and Drop Tables 178 Chapter 13: Indexes, Sequences, and Views 188 Chapter 14: The Data Dictionary, Scripting, and Reporting 197 Chapter 15: Security 213 Chapter 16: Regular Expressions and Hierarchical Queries 222 Chapter 17: Exploring Data Warehousing Features 235 Chapter 18: SQL Optimization 248 Chapter 1: SQL and Data In this chapter, you learned about data, how data is organized in tables, and how the relationships among the tables are depicted in a schema diagram. Based on your newly acquired knowledge, design a schema diagram based on the fictional ACME Construction Company. Draw on your own work experience to design the following components. 1. Draw boxes for these three tables: EMPLOYEE, POSITION, and DEPARTMENT. Solution: See the solution for Exercise 3. 2. Create at least three columns for each of the tables and designate a primary key for each table. Solution: See the solution for Exercise 3. 3. Create relationships among the...
Words: 6586 - Pages: 27
...MET CS 669 Database Design and Implementation for Business SQL Lab 4 Instructions: Procedural SQL Objective The objective of this lab is to teach you how to develop and use basic stored procedures and triggers the procedural language of your chosen DBMS. Prerequisites Before attempting this lab, it is best to read the textbook and lecture material covering the objectives listed above. While this lab shows you how to create and use these constructs in SQL, the lab does not explain in full the theory behind the constructs, as does the lecture and textbook. The second section in this lab builds on Lab 3. It is best to complete Lab 3 first before completing the second section in this lab. Required Software The examples in this lab will execute in modern versions of Oracle and Microsoft SQL Server as is. Note that the first section in this lab has syntax specific to each DBMS, and you will need to complete the version for the DBMS you are using. If you are using a different RDBMS, you may need to modify the SQL for successful execution. Saving Your Data If you choose to perform portions of the assignment in different sittings, it is important to commit your data at the end of each session. This way, you will be sure to make permanent any data changes you have made in your curent session, so that you can resume working without issue in your next session. To do so, simply issue this command: COMMIT; Data changes in one session will only be visible only in that session...
Words: 6758 - Pages: 28
...executes a dynamic SQL statement or an anonymous PL/SQL block. ____ 2. The %TYPE feature allows you to anchor variable declarations to a column in a table. ____ 3. COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. ____ 4. The only required sections of a PL/SQL block are BEGIN and END. ____ 5. The EXCEPTION handling section is an optional section in a PL/SQL block. ____ 6. The keyword DEFAULT can be used in place of the := symbol to assign initial values to the variables within the declaration statement. ____ 7. Declaring a table of records variable in a package specification allows it to persist for a user session. ____ 8. Implicit cursors are declared automatically for all INSERT, UPDATE, and DELETE statements issued within a PL/SQL block. ____ 9. You can process multiple rows of data from a database by creating explicit cursors. ____ 10. With an implicit cursor, Oracle closes the SQL cursor automatically after executing its associated SQL statement. As a result, %ISOPEN always yields FALSE. ____ 11. The basic loop uses the LOOP and END LOOP markers to begin and end the loop code. ____ 12. Dynamic SQL lets you write schema-management procedures that can be centralized in one schema, and can be called from other schemas and operate on the objects in those schemas. ____ 13. In PL/SQL, if a SELECT ... INTO statement returns no rows, Oracle does not return an error. ____ 14. In PL/SQL, a SELECT ......
Words: 1344 - Pages: 6
...Arceneaux December 22, 2014 Figure 1: (Microsoft.com, 2014) Table of Contents Database Security Architecture 3 Differences between a database and a DBMS 3 Types of database designs 4 Network Infrastructure for Database Security 5 Common Security Threats for Database Servers: 6 Additional Security Mechanisms for Protecting Database Server 9 User Account Security 11 1. New Schema for HR Database 11 2. Corporate Directory & Manager Information Views: 12 3. Created Users: 14 4. Created Roles: 15 5. Implemented the Following Access Control List using SQL: 15 6. Implementation and Utilization of Roles: 16 7. HR Database SQL 16 Database Vulnerabilities 29 Auditing Techniques 47 Example database Trigger 50 Creating and Implementing a Database Audit 50 Access Reports 61 Logon Activity History 63 Complete Audit Trail 65 DML History 67 Auditing Policies 69 SQL Server 2014 Audit Report Generation 78 Database Security Architecture Differences between a database and a DBMS When discussing the database management systems (DBMS) and databases, the lines can become blurred between the two. Many people consider a DBMS and a database to be one in the same. However, nothing could be further from the truth as they are two separate distinct entities that server specific purposes. To further expound on this premise, a database management system or DBMS, and sometimes called a database manager, is a software application that is used for creating...
Words: 8566 - Pages: 35
...(MEMBERSHIP). A video can be rented many times over its lifetime, therefore, there is a M:N relationship between RENTAL and VIDEO. DETAILRENTAL is the bridge table to resolve this relationship. The complete ERD is provided in Figure P7.65. 65. Write the SQL code to create the table structures for the entities shown in Figure P7.65. The structures should contain the attributes specified in the ERD. Use data types that would be appropriate for the data that will need to be stored in each attribute. Enforce primary key and foreign key constraints as indicated by the ERD. MEMBERSHIP Mem_ Num Mem_ Fname Mem_ Lname Mem_Street Mem_City Mem_ State Mem_Zip Mem_ Balance RENTAL Rent_Num Rent_Date Mem_Num DETAILRENTAL Rent_Num Vid_Num Detail_Fee Detail_Duedate Detail_Returndate Detail_Dailylatefee VIDEO Vid_Num Vid_Indate Movie_Num MOVIE Movie_Num Movie_Name Movie_Year Movie_Cost Movie_Genre Price_Code PRICE Price_Code Price_Description Price_Rentfee Price_Dailylatefee 68. Write the SQL command to change the movie year for movie number 1245 to 2010. UPDATE Movie SET MOVIE_YEAR = 2010 WHERE MOVIE_NUM = 1245; 69. Write the SQL command to change the price code for all Action movies to price code 3. UPDATE Movie SET...
Words: 344 - Pages: 2
...Teach Yourself SQL in 21 Days, Second Edition Table of Contents: Introduction Week 1 at a Glance Day 1 Introduction to SQL Day 2 Introduction to the Query: The SELECT Statement Day 3 Expressions, Conditions, and Operators Day 4 Functions: Molding the Data You Retrieve Day 5 Clauses in SQL Day 6 Joining Tables Day 7 Subqueries: The Embedded SELECT Statement Week 1 in Review Week 2 at a Glance Day 8 Manipulating Data Day 9 Creating and Maintaining Tables Day 10 Creating Views and Indexes Day 11 Controlling Transactions Day 12 Database Security Day 13 Advanced SQL Topics Day 14 Dynamic Uses of SQL Week 2 in Review Week 3 at a Glance Day 15 Streamlining SQL Statements for Improved Performance Day 16 Using Views to Retrieve Useful Information from the Data Dictionary Day 17 Using SQL to Generate SQL Statements Day 18 PL/SQL: An Introduction Day 19 Transact-SQL: An Introduction Day 20 SQL*Plus Day 21 Common SQL Mistakes/Errors and Resolutions Week 3 in Review Appendixes A Glossary of Common SQL Statements B Source Code Listings for the C++ Program Used on Day 14 C Source Code Listings for the Delphi Program Used on Day 14 D Resources E ASCII Table F Answers to Quizzes and Excercises © Copyright, Macmillan Computer Publishing. All rights reserved. Teach Yourself SQL in 21 Days, Second Edition Acknowledgments A special thanks to the following individuals: foremost to my loving wife, Tina, for her tolerance and endless support, to Dan Wilson for his...
Words: 128515 - Pages: 515
...query? 2.3 What does SQL stand for, and what is SQL? 2.4 What does SKU stand for? What is an SKU? 2.5 Summarize how data were altered and filtered in creating the Cape Codd data extraction. 2.6 Explain, in general terms, the relationships among the RETAIL_ORDER, ORDER_ITEM, and SKU_DATA tables. 2.7 Summarize the background of SQL. 2.8 What is SQL-92? How does it relate to SQL statements in this chapter? 2.9 What features have been added to SQL in versions subsequent to the SQL-92? 2.10 Why is SQL described as a data sublanguage? 2.11 What does DML stand for? What are DML statements? 2.12 What does DDL stand for? What are DDL statements? 2.13 What is the SQL SELECT /FROM/WHERE framework? 2.14 Explain how Access uses SQL. 2.15 Explain how enterprise-class DBMS products use SQL. 2.16 There is an intentional flaw in the design of the INVENTORY table used in these exercises. This flaw was purposely included in the INVENTORY tables so that you can answer some of the following questions using only that table. Compare the SKU and INVENTORY tables, and determine what design flaw is included in INVENTORY. Specifically, why did we include it? 2.17 Write an SQL statement to display SKU and SKU_Description. 2.18 Write an SQL statement to display SKU_Description and SKU. 2.19 Write an SQL statement to display Warehouse. 2.20 Write an SQL statement to display Warehouse...
Words: 7421 - Pages: 30
...INTRODUCTION SQL is divided into the following Data Definition Language (DDL) Data Manipulation Language (DML) Data Retrieval Language (DRL) Transaction Control Language (TCL) Data Control Language (DCL) DDL -- create, alter, drop, truncate, rename DML -- insert, update, delete DRL -- select TCL -- commit, rollback, savepoint DCL -- grant, revoke CREATE TABLE SYNTAX Create table (col1 datatype1, col2 datatype2 …coln datatypen); Ex: SQL> create table student (no number (2), name varchar (10), marks number (3)); INSERT This will be used to insert the records into table. We have two methods to insert. a) By value method By address method USING VALUE METHOD Syntax: insert into (table_name) values (value1, value2, value3 …. Valuen); © Copy rights are reserved. 2 Ex: SQL> insert into student values (1, ’sudha’, 100); SQL> insert into student values (2, ’saketh’, 200); To insert a new record again you have to type entire insert command, if there are lot of records this will be difficult. This will be avoided by using address method. b) USING ADDRESS METHOD Syntax: insert into (table_name) values (&col1, &col2, &col3 …. &coln); This will prompt you for the values but for every insert you have to use forward slash. Ex: SQL> insert into student values (&no, '&name', &marks); Enter value for no: 1 Enter value for name: Jagan Enter value for marks: 300 old new SQL> 1:...
Words: 42387 - Pages: 170
...Database Management System Basith Shaik Southern New Hampshire University September 7, 2015 Abstract The intent of this paper is to design and propose a database management system solution to Grandfield College for tracking software installed. I have analyzed the organizational issues and needs and developed conceptual, logical, and physical designs of DBMS solution. In order to implement the solution, substantial research had been done on best practices in design, available products, and the legal and ethical standards to which we must adhere during design. This paper includes Business rules, Conceptual, Logical, and Physical database designs, Recommendations on best DBMS required for Grandfield College, Data model, Legal Compliance, Ethical Practices, Security Needs and Security Plan Keywords: Grandfield College, Database Design, Recommendations, Business Rules, Data model, Security Plan Database Management System Grandfield College is in need of Database Management System as law requires that any business, including a school, track its software. It is important to know what software the school owns, in what versions, and what the license agreement for that software is. For this purpose I have developed a Software Tracking database for Grandfield College. Problem Grandfield College is in need of a database for effectively tracking faculty and staff computers, the software installed on those systems, User access to each computer, and requests for new software installation...
Words: 4672 - Pages: 19
...Testing at the data access layer is the point at which your application communicates with the database. Tests at this level are vital to improve not only your overall test strategy, but also your product’s quality. In this presentation you’ll find out what you need to know to test the SQL database engine, stored procedures, and data views. Find out how to design effective automated tests that exercise the complete database layer of your applications. You’ll learn about the most common and vexing defects related to SQL databases and the best tools available to support your testing efforts. Copyright Sammamish Software Services 2003. All rights Reserved 1 8/26/2004 The Data Access Layer Testing at the data access layer is the point at which your application communicates with the database. ! In this presentation we’ll discuss why tests at this level are vital to improve not only your overall test strategy, but also your product’s quality ! Copyright Sammamish Software Services 2003. All rights reserved. 2 How to design effective automated tests that exercise the complete database layer of your applications. Donation Street demo The most common and vexing defects related to SQL database The best tools available to support your testing efforts. A strong foundation in Structured Query Language is becoming increasingly necessary and even required by some companies in today’s data environments. Many test professionals are...
Words: 5030 - Pages: 21