9781637144664 Flipbook PDF


6 downloads 113 Views 11MB Size

Recommend Stories


Porque. PDF Created with deskpdf PDF Writer - Trial ::
Porque tu hogar empieza desde adentro. www.avilainteriores.com PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com Avila Interi

EMPRESAS HEADHUNTERS CHILE PDF
Get Instant Access to eBook Empresas Headhunters Chile PDF at Our Huge Library EMPRESAS HEADHUNTERS CHILE PDF ==> Download: EMPRESAS HEADHUNTERS CHIL

Story Transcript

Hands On SQL

Abhishek Choudhary

Copyright © 2020 Abhishek Choudhary All rights reserved. ISBN: 9781637144664

DEDICATION This book is dedicated to All the faculty of Guru Nanak Institute of Technology & My friends.

Hands On SQL

4

Hands On SQL About the Author

Abhishek Choudhary has a degree in Information Technology from Guru Nanak Institute of Technology. He picked up interest in Database, Unix, Cloud based technology when working in IT companies. He provides writing notes, coaching and mentoring student as a service. His educational background in science has given him a broad base from which to approach many topics. His writing skills may be confirmed independently on https://tech4urhelp.blogspot.com/ .He especially enjoys mentoring individuals who are changing careers. You may learn more about His services at https://tech4urhelp.blogspot.com/.

“Stay hungry. Stay foolish “ - Steve Jobs

“Dream is not that which you see while sleeping

it is something that does not let you sleep.” - A.P.J Abdul Kalam

5

Hands On SQL

Tell Us What You Think!

As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to computers or the Mobile Devices? Then check out our Technology sharing platform like YouTube and Facebook. If you prefer the World Wide Web, check out our site at

https://tech4urhelp.blogspot.com/ NOTE: If you have a technical question about this book, send email to [email protected] . As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book--as well as what we can do to make our books stronger. Here's the information: E-mail: [email protected]

6

Hands On SQL

Table of Contents 1.Introduction to DBMS............................................................... 9 Basic of DBMS ........................................................................ 10 Normalization ........................................................................ 15 ERD ........................................................................................ 18 2.SQL Fundamental ................................................................... 21 SQL Introduction.................................................................... 22 Retrieving Data Using the SQL SELECT Statement ................ 24 Restricting and Sorting Data .................................................. 25 Single-Row Functions to Customize Output .......................... 26 Reporting Aggregated Data Using the Group Functions ....... 30 DML Operation ...................................................................... 32 3.Data extraction from multiple Table ...................................... 37 Join Questions ....................................................................... 38 Subqueries Questions ............................................................ 42 Set Operator Questions ......................................................... 45 4.Database object handling ....................................................... 49 Naming Rule .......................................................................... 50 Create database object.......................................................... 52 Index Question ...................................................................... 54 Constraints............................................................................. 61 Alter object ............................................................................ 64 Drop object ............................................................................ 65 7

Hands On SQL 5.User and transaction handling ............................................... 67 6.Regular Expression ................................................................. 73 7.Analytic Function .................................................................... 79 8.Hands On SQL ......................................................................... 81 MCQ ....................................................................................... 82 I. SCHEMAS and Table Desc : ................................................. 86 II . SCHEMAS and Table Desc: ................................................ 92 Challenging problem: ............................................................ 96 Thanks for Reading!!! .............................................................. 100

8

Hands On SQL

1.Introduction to DBMS

Basic of Database Normalization ERD

9

Hands On SQL

Basic of DBMS 1. What are data and information, and how are they related in a database? Data is recorded facts and figures, and information is knowledge derived from data. A database stores data in such a way that information can be created. 2. Explain the differences between structured data and unstructured data. Structured data are facts concerning objects and events. The most important structured data are numeric, character, and dates. Structured data are stored in tabular form. Unstructured data are multimedia data such as documents, photographs, maps, images, sound, and video clips. Unstructured data are most commonly found on Web servers and Web-enabled databases. 3. What is a database? A database is a logically coherent collection of data with some inherent meaning, representing some aspect of the real world and which is designed, built and populated with data for a specific purpose. 4. What is DBMS? DBMS stands for Database Management System. It is a collection of programs that enables users to create and maintain a database. A DBMS receives requests from applications and translates those requests into actions on a specific database. In other words, it is general-purpose software that provides the users with the processes of defining, constructing and manipulating the database for various applications. 5. What is a Database system? The database and DBMS software together are called a Database system.

10

Hands On SQL 6. What are the advantages of DBMS? 1. 2. 3. 4. 5.

Redundancy is controlled. Unauthorized access is restricted. Providing multiple user interfaces. Enforcing integrity constraints. Providing backup and recovery.

7. What do you mean by flat file database? & What are the disadvantages of the File Processing System? It is a database in which there are no programs or user access languages. It has no cross-file capabilities but is user-friendly and provides user-interface management. Disadvantages of the File Processing System 1. 2. 3. 4. 5. 6.

Data redundancy and inconsistency. Difficult in accessing data. Data isolation. Data integrity. Concurrent access is not possible. Security Problems.

8. Explain why it is still necessary to have at least some familiarity with file processing systems even though it has become evident that traditional file processing systems have a number of shortcomings and limitations. Many businesses still use file processing systems today. This is especially true in the creation of backups for a database system. In addition, if you understand some of the limitations of a file processing system such as program-data dependence, duplication of data, limited data sharing, lengthy development times, and excessive program maintenance, you can try and avoid them as you design and develop a database.

11

Hands On SQL 9. What are some of the disadvantages associated with conventional file processing systems? There are five disadvantages. Program-data dependence occurs when file descriptions need to be changed in all programs whenever a file description changes. Duplication of data is storing the data more than one time. Limited data sharing occurs when the files are private so no one outside of one application can access the data. Lengthy development times exist because file processing systems take longer to develop. Lastly, excessive program maintenance exists since the effort to maintain a program is larger in this environment. 10. What are some of the important security features of a DBMS? One of the features includes the use of views which allows the presentation of only data needed by someone and limits the capability of database updates. The use of integrity controls includes such things as domains, assertions, and checks. Also, authorization rules, user-defined procedures, encryption, authentication schemes, and backups are important 11. Describe the three levels of data abstraction? The three levels of abstraction: 1. 2. 3.

Physical level: The lowest level of abstraction describes how data are stored. Logical level: The next higher level of abstraction, describes what data is stored in the database and what relationship among those data. View level: The highest level of abstraction describes only part of the entire database.

12. What is "transparent DBMS"? It is one, which keeps its Physical Structure hidden from the user. 13. What is RDBMS KERNEL? Two important pieces of RDBMS architecture are the kernel, which is the software, and the data dictionary, which consists of the system-level data structures used by the kernel to manage the database You might think of an

12

Hands On SQL RDBMS as an operating system (or set of subsystems), designed specifically for controlling data access; its primary functions are storing, retrieving, and securing data. An RDBMS maintains its own list of authorized users and their associated privileges; manages memory caches and paging; controls locking for concurrent resource usage; dispatches and schedules user requests; and manages space usage within its table-space structures. 14. Name the sub-systems of a RDBMS. I/O, Security, Language Processing, Process Control, Storage Management, Logging and Recovery, Distribution Control, Transaction Control, Memory Management, Lock Management. 15. What is OLAP and OLTP? On Line Analytical Processing (OLAP) is a Business Intelligence (BI) reporting system. OLAP provides the user with the capability to sum, count, average and do other simple arithmetic operations on groups of data. An OLAP report has measures and dimensions. Measures are the data values to be displayed. Dimensions are characteristics of the measures. OLAP reports are called OLAP cubes, although such reports are not limited to three dimensions. Online Transactional Processing (OLTP) is a category of data processing that is focused on transaction-oriented tasks. OLTP typically involves inserting, updating, and/or deleting small amounts of data in a database. OLTP mainly deals with large numbers of transactions by a large number of users. 16. Describe the difference between a homogeneous and heterogeneous distributed database. A homogenous database is one that uses the same DBMS at each node. Either each node can work independently or a central DBMS may coordinate database activities. A heterogeneous database is one that may have a different DBMS at each node. It may support some or all of the functionality of one logical database. It may support full Distributed DBMS functionality or partial Distributed DBMS functionality.

13

Hands On SQL 17. What is a distributed database? A distributed database is a single logical database that is spread across more than one node or locations that are all connected via some communication link. It requires multiple DBMSs, running at each remote site. A distributed database can be either homogeneous (same DBMS at each node) or heterogeneous (different DBMS at some nodes). 18. Explain the difference between two and three-tier architectures. A three-tier architecture includes a client and two server layers. The application code is stored on the application server and the database is stored on the database server. A two-tier architecture includes a client and one server layer. The database is stored on the database server. 19. Describe why operational and informational systems are separate. Operational systems are used to run the business in real time on a daily basis and contain current data. Non-managers and non-analysts work in this type of system. Operational systems must process large volumes of data. Informational systems are used to support decisions and contain historical data. Managers and analysts work in this type of system. Informational systems have periodic batch updates.

14

Hands On SQL

Normalization 1. Who is E.F. Codd, and why is he significant in the development of modern database systems? While working at IBM, E.F. Codd created the relational database model. A paper he published in 1970 presented his ideas to the world at large. His work is the foundation for most of the DBMSs currently in use, and thus forms the basis for database systems as we know and use them today. 2. What is normalization? denormalization? Normalization: It is a process of analysing the given relation schemas based on their Functional Dependencies (FDs) and primary key to achieve the properties (1). Minimizing redundancy, (2). Minimizing insertion, deletion and update anomalies. Denormalization: Denormalization refers to a refinement to the relational schema such that the degree of normalization for a modified relation is less than the degree of at least one of the original relations. It can also be referred to as a process in which we combine two relations into one relation, and the new relation is still normalized but contains more null than original relations. Steps of Denormalization 1.

Combining one -to-one (1:1) relationships.

2. Duplicating non-key attributes in one-to-many (1: *) relationship to reduce joins. 3. Duplicating foreign key attributes in one-to-many (1: *) relationship to reduce joins. 4. Duplicating attributes key attributes in many-to-many (*: *) relationship to reduce joins. 5.

Introducing repeating groups.

15

Get in touch

Social

© Copyright 2013 - 2024 MYDOKUMENT.COM - All rights reserved.