Oracle SQL and PL/SQL
By Niraj Gupta
4.5/5
()
About this ebook
80 Most Asked SQL Questions and Answers
60 Most Asked PL/SQL Questions and Answers
51 Most Asked Basic SQL Queries with Examples
25 Most Asked Complex SQL Queries with Examples
120 SQL and PL/SQL Tips and Concepts
Related to Oracle SQL and PL/SQL
Related ebooks
Advanced Oracle PL/SQL Developer's Guide - Second Edition Rating: 5 out of 5 stars5/5SQL Server: Tips and Tricks - 1 Rating: 5 out of 5 stars5/5SQL Server: Tips and Tricks - 2 Rating: 4 out of 5 stars4/5Sql Simplified:: Learn to Read and Write Structured Query Language Rating: 0 out of 5 stars0 ratings100+ SQL Queries T-SQL for Microsoft SQL Server Rating: 4 out of 5 stars4/5Basic DBA Query v.1: Oracle Database Rating: 5 out of 5 stars5/5SQL in 30 Pages Rating: 4 out of 5 stars4/5100+ SQL Queries Jet SQL for Microsoft Office Access Rating: 5 out of 5 stars5/5SQL Interview Questions: A complete question bank to crack your ANN SQL interview with real-time examples Rating: 0 out of 5 stars0 ratingsJoe Celko's SQL for Smarties: Advanced SQL Programming Rating: 3 out of 5 stars3/5Querying with SQL T-SQL for Microsoft SQL Server Rating: 3 out of 5 stars3/5Oracle SQL Developer Rating: 0 out of 5 stars0 ratingsThe SQL Workshop: Learn to create, manipulate and secure data and manage relational databases with SQL Rating: 0 out of 5 stars0 ratingsLearn SQL in 24 Hours Rating: 5 out of 5 stars5/5SQL Tutorial For Beginners Rating: 0 out of 5 stars0 ratingsSQL Server 2014 Development Essentials Rating: 5 out of 5 stars5/5What Is Sql ?: Fundamentals of Sql,T-Sql,Pl/Sql and Datawarehousing. Rating: 0 out of 5 stars0 ratingsInterview Questions for DB2 z/OS Application Developers Rating: 0 out of 5 stars0 ratingsCreating your MySQL Database: Practical Design Tips and Techniques Rating: 3 out of 5 stars3/5DB2 11 for z/OS: SQL Basic Training for Application Developers Rating: 4 out of 5 stars4/5Database Design and SQL for DB2 Rating: 5 out of 5 stars5/5Learning PostgreSQL Rating: 1 out of 5 stars1/5SQL for Microsoft Office Access Rating: 3 out of 5 stars3/5Oracle APEX Tips and Tricks Rating: 0 out of 5 stars0 ratingsLearn MongoDB in 24 Hours Rating: 5 out of 5 stars5/5SQL Server MVP Deep Dives Rating: 0 out of 5 stars0 ratingsOracle APEX Tips and Tricks: II Rating: 0 out of 5 stars0 ratingsInterview Questions for IBM Mainframe Developers Rating: 1 out of 5 stars1/5
Computers For You
101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 4 out of 5 stars4/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Elon Musk Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsCompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratingsThe Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Master Builder Roblox: The Essential Guide Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Artificial Intelligence: The Complete Beginner’s Guide to the Future of A.I. Rating: 4 out of 5 stars4/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5CompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5
Reviews for Oracle SQL and PL/SQL
8 ratings3 reviews
- Rating: 5 out of 5 stars5/5I want to download this post, please help me, it is very helpful for the basics of any level PL/SQL interview preparation.
Thanks - Rating: 4 out of 5 stars4/5The book is fine. You cover a lot of material with this book. start well ahead.
- Rating: 3 out of 5 stars3/5so nice....
Book preview
Oracle SQL and PL/SQL - Niraj Gupta
Success Guide to Oracle SQL and PL/SQL
By Niraj Gupta
Copyright 2014 Niraj Gupta
Smashwords Edition
Smashwords Edition, Licence Notes
Thank you for downloading this book. Please note that this book may not be re-sold or
given away to other people. It remains the copyrighted property of the author, and may
not be reproduced, copied and distributed for commercial or non-commercial purposes. If
you enjoyed this book, please encourage your friends to download their own copy at
Smashwords.com, where they can also discover other works by this author. Thank you for
your support.
Table of Contents
Best 80 SQL Questions and Answers
Best 60 PL/SQL Questions and Answers
Best 51 Solved Basic SQL Queries
Best 25 Solved Advanced SQL Queries
Best 120 SQL and PL/SQL Tips
Best 80 SQL Questions and Answers
Question 1: What is SQL and also describe types of SQL statements?
SQL stands for Structured Query Language. SQL is a language used to communicate with the server to access, manipulate and control data.
There are 5 different types of SQL statements.
1) Data Retrieval: SELECT
2) Data Manipulation Language (DML): INSERT, UPDATE, DELETE, MERGE
3) Data Definition Language (DDL): CREATE, ALTER, DROP, RENAME, TRUNCATE.
4) Transaction Control Statements: COMMIT, ROLLBACK, SAVEPOINT
5) Data Control Language (DCL): GRANT, REVOKE
Question 2: What is an alias in SQL statements?
Alias is a user-defined alternative name given to the column or table. By default column alias headings appear in upper case. Enclose the alias in a double quotation marks (
) to make it case sensitive. "AS" Keyword before the alias name makes the SELECT clause easier to read.
For ex: Select empname AS name from employee; (Here AS is a keyword and name
is an alias).
Question 3: What is a Literal? Give an example where it can be used?
A Literal is a string that can contain 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. Date and character literals must be enclosed within single quotation marks (‘ ‘), number literals need not.
For ex: Select last_name||’is a’||job_id As emp details
from employee; (Here is a
is a literal).
Question 4: What is a difference between SQL and iSQL*Plus?
SQL iSQL*Plus
Is a LanguageIs an Environment
Character and date columns heading
are left-justified and number column
headings are right-justified.Default heading justification is in Centre.
Cannot be Abbreviated (short forms)Can be Abbreviated
Does not have a continuation characterHas a dash (-) as a continuation character if the command is longer than one line
Use Functions to perform some formattingUse commands to format data
Question 5: Define the order of Precedence used in executing SQL statements.
Order Evaluated Operator
1Arithmetic operators (*, /, +, -)
2Concatenation operators (||)
3Comparison conditions
4Is[NOT] NULL, LIKE, [NOT] IN
5[NOT] BETWEEN
6NOT Logical condition
7AND logical condition
8OR logical condition
Question 6: What are SQL functions? Describe in brief different types of SQL functions?
SQL Functions are very powerful feature of SQL. SQL functions can take arguments but always return some value.
There are two distinct types of SQL functions:
1) Single-Row functions: These functions operate on a single row to give one result per row.
Types of Single-Row functions:
1) Character
2) Number
3) Date
4) Conversion
5) General
2) Multiple-Row functions: These functions operate on groups of rows to give one result per group of rows.
Types of Multiple-Row functions:
1) AVG
2) COUNT
3) MAX
4) MIN
5) SUM
6) STDDEV
7) VARIANCE
Question 7: Explain character, number and date function in detail?
Character functions: accept character input and return both character and number values. Types of character function are:
a) Case-Manipulation Functions: LOWER, UPPER, INITCAP
b) Character-Manipulation Functions: CONCAT, SUBSTR, LENGTH, INSTR, LPAD/RPAD, TRIM, REPLACE
Number Functions: accept Numeric input and return numeric values. Number Functions are: ROUND, TRUNC and MOD
Date Functions: operates on values of the Date data type. (All date functions return a value of DATE data type except the MONTHS_BETWEEN Function, which returns a number. Date Functions are MONTHS_BETWEEN, ADD_MONTHS, NEXT_DAY, LAST_DAY, ROUND, TRUNC.
Question 8: What is a Dual Table?
Dual table is owned by the user SYS and can be accessed by all users. It contains one column Dummy and one row with the value X. The Dual Table is useful when you want to return a value only once. The value can be a constant, pseudocolumn or expression that is not derived from a table with user data.
Question 9: Explain Conversion function in detail?
Conversion Functions converts a value from one data type to another. Conversion functions are of two types:
Implicit Data type conversion:
1) VARCHAR2 or CHAR To NUMBER, DATE
2) NUMBER To VARCHAR2
3) DATE To VARCHAR2
Explicit data type conversion:
1) TO_NUMBER
2) TO_CHAR
3) TO_DATE
TO_NUMBER function is used to convert Character string to Number format. TO_NUMBER function use fx modifier. Format: TO_NUMBER ( char[, ‘ format_model’] ). fx modifier specifies the exact matching for the character argument and number format model of TO_NUMBER function.
TO_CHAR function is used to convert NUMBER or DATE data type to CHARACTER format. TO_CHAR Function use fm element to remove padded blanks or suppress leading zeros. TO_CHAR Function formats:TO_CHAR (date, ‘format_model’).Format model must be enclosed in single quotation marks and is case sensitive.
For ex: Select TO_CHAR (hiredate, ‘MM/YY’) from employee.
TO_DATE function is used to convert Character string to date format. TO_DATE function use fx modifier which specifies the exact matching for the