* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Explicit cursors
Data Protection Act, 2012 wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Data center wikipedia , lookup
Forecasting wikipedia , lookup
Data analysis wikipedia , lookup
3D optical data storage wikipedia , lookup
Relational model wikipedia , lookup
Clusterpoint wikipedia , lookup
Information privacy law wikipedia , lookup
Data vault modeling wikipedia , lookup
JRE SCHOOL OF Engineering Solutions Subject Name DBMS & DWM Subject Code For EE-VI Sem. only SECTION – A ECS-019 Q1. Explain aggregate functions in SQL. The SQL Aggregate Functions are functions that provide mathematical operations. If you need to add, count or perform basic statistics, these functions will be of great help. The functions include: count() - counts a number of rows sum() - compute sum avg() - compute average min() - compute minimum max() - compute maximum Q2. What is data mart? Explain its role in data warehousing. A data mart is a simple form of a data warehouse that is focused on a single subject (or functional area), such as Sales, Finance, or Marketing. Data marts are often built and controlled by a single department within an organization. Given their singlesubject focus, data marts usually draw data from only a few sources. The sources could be internal operational systems, a central data warehouse, or external data. Each Data Mart can contain different combinations of tables, columns and rows from the Enterprise Data Warehouse. For example, an business unit or user group that doesn't require a lot of historical data might only need transactions from the current calendar year in the database. The Personnel Department might need to see all details about employees, whereas data such as "salary" or "home address" might not be appropriate for a Data Mart that focuses on Sales. SECTION – B Q1. Discuss the differences between data warehouse and database system. Database Data Warehouse Any collection of data organized for A type of database that integrates storage, accessibility, and retrieval. copies of transaction data from disparate source systems and provisions them for analytical use. There are different types of databases, but the term usually applies to an OLTP application database, which we’ll focus on throughout this table. Other types of databases include OLAP (used for A data warehouse is an OLAP database. An OLAP database layers on top of OLTPs or other databases to perform analytics. An important side note about this type of database: Not all OLAPs are created equal. They Database Data Warehouse data warehouses), XML, CSV files, flat text, and even Excel spreadsheets. We’ve actually found that many healthcare organizations use Excel spreadsheets to perform analytics (a solution that is not scalable). differ according to how the data is modelled. Most data warehouses employ either an enterprise or dimensional data model, but at Health Catalyst, we advocate a unique, adaptive Late- Binding™ approach. You can learn more about why the Late-Binding™ approach is so important in healthcare analytics in Late-Binding vs. Models: A Comparison of Healthcare Data Warehouse Methodologies. Typically constrained to a single application: one application equals one database. An EHR is a prime example of a healthcare application that runs on an OLTP database. OLTP allows for quick real-time transactional processing. It is built for speed and to quickly record one targeted process (ex: patient admission date and time). Accommodates data storage for any number of applications: one data warehouse equals infinite applications and infinite databases. OLAP allows for one source of truth for an organization’s data. This source of truth is used to guide analysis and decision-making within an organization (ex: total patients over age 18 who have been readmitted, by department and by month). Interestingly enough, complex queries like the one just described are much more difficult to handle in an OLTP database. Q2. Explain cursors in SQL with an example. A cursor is a temporary work area created in the system memory when a SQL statement is executed. A cursor contains information on a select statement and the rows of data accessed by it. This temporary work area is used to store the data retrieved from the database, and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. The set of rows the cursor holds is called the active set. There are two types of cursors in PL/SQL: Implicit cursors These are created by default when DML statements like, INSERT, UPDATE, and DELETE statements are executed. They are also created when a SELECT statement that returns just one row is executed. Explicit cursors They must be created when you are executing a SELECT statement that returns more than one row. Even though the cursor stores multiple records, only one record can be processed at a time, which is called as current row. When you fetch a row the current row position moves to next row. Both implicit and explicit cursors have the same functionality, but they differ in the way they are accessed. For Example: Consider the PL/SQL Block that uses implicit cursor attributes as shown below: DECLARE var_rows number(5); BEGIN UPDATE employee SET salary = salary + 1000; IF SQL%NOTFOUND THEN dbms_output.put_line('None of the salaries where updated'); ELSIF SQL%FOUND THEN var_rows := SQL%ROWCOUNT; dbms_output.put_line('Salaries for ' || var_rows || 'employees are updated'); END IF; END; Q3. Describe the structure of a data warehouse with the help of a diagram. • The central data warehouse database is a cornerstone of data warehousing environment • These approaches include the following: – Parallel relational database designs that require a parallel computing platform – An innovative approach to speed up a traditional RDBMS by using new index structures to bypass relational table scans – Multidimensional database (MDDBs) that are based on proprietary database technology or implemented using already familiar RDBMS. Multidimensional database are designed to overcome any limitations placed on the warehouse by the nature of the relational data model • A significant portion of the data warehouse implementation effort is spent extracting data from operational systems and putting it in a format suitable for informational applications that will run off the data warehouse • Metadata is data about data that describes the data warehouse. • It is used for building, maintaining, managing, and using the data warehouse. • Metadata can be classified into the following: – Technical metadata – Business metadata – Data warehouse operational information such as data history (snapshots, versions), ownership, extract audit trail, usage data Most organizations engage in data mining to do the same following: – Discovering knowledge: segmentation, classification, association and preferencing. – Visualizing Data – Correct data SECTION – C Q1. Specify the following queries in SQL based on given schema Suppliers(sid,sname,city) Part(pid,pname,color) Sp(sid,pid,quantity) i. Get the names of suppliers whose name begins with R ii. Get pairs of supplier numbers that both operate from same city. iii. Get the names of suppliers who supply part P2. iv. Get the supplier id and names of suppliers in descending order of city. v. Get the part numbers and total quantity supplied. (i)select sname from supplier where sname like ‘k%’. (ii)select s1.sid as sid1,s2.sid as sid2 from supplier s1,supplier s2 where s1.city = s2.city and s1.sid<s2.sid. (iii)select sname from supplier ,Part,Sp where Supplier.sid = sp.sid AND sp.pid = Part.pid AND Part.pid =p2. (iv) select sid,sname from supplier order by city desc. (v) select Pname ,quantity from Sp s,Part p where s.pid=p.pid. Q2. What are the differences between the three main types of data warehouse usage: information processing, analytical processing and data mining? Briefly explain. Data Mining:-Generally, data mining (sometimes called data or knowledge discovery) is the process of analyzing data from different perspectives and summarizing it into useful information - information that can be used to increase revenue, cuts costs, or both. Data mining software is one of a number of analytical tools for analyzing data. It allows users to analyze data from many different dimensions or angles, categorize it, and summarize the relationships identified. Technically, data mining is the process of finding correlations or patterns among dozens of fields in large relational databases. Analytical Processing:-OLAP (online analytical processing) is computer processing that enables a user to easily and selectively extract and view data from different points of view. For example, a user can request that data be analyzed to display a spreadsheet showing all of a company's beach ball products sold in Florida in the month of July, compare revenue figures with those for the same products in September, and then see a comparison of other product sales in Florida in the same time period. To facilitate this kind of analysis, OLAP data is stored in a multidimensional database. Whereas a relational database can be thought of as two-dimensional, a multidimensional database considers each data attribute (such as product, geographic sales region, and time period) as a separate "dimension." OLAP software can locate the intersection of dimensions (all products sold in the Eastern region above a certain price during a certain time period) and display them. Attributes such as time periods can be broken down into subattributes. OLAP can be used for data mining or the discovery of previously undiscerned relationships between data items. An OLAP database does not need to be as large as a data warehouse, since not all transactional data is needed for trend analysis. Using Open Database Connectivity (ODBC), data can be imported from existing relational databases to create a multidimensional database for OLAP. Information Processing:• • The functionality includes: – Removing unwanted data from operational databases – Converting to common data names and definitions – Calculating summaries and derived data – Establishing defaults for missing data – Accommodating source data definition changes The data sourcing, cleanup, extract, transformation and migration tools have to deal with some significant issues, as follows: – Database heterogeneity. – Data heterogeneity. Q3. Consider the following relational schema:Student(name,roll_number,address,main) Admission(roll_no,course,semester) Faculty(course,faculty,semester) Offering(branch,course) Assume suitable assumption if you need and write the following queries in SQL:i. The names of the students admitted in a particular course in a given semester. ii. Students who have taken all the courses offered by the faculty ‘Ms. Sheela’. iii. Name all the faculty who had taught student ‘Abhishek’. iv. All courses taken by student ‘Asim’. v. Find the names of all students who are studying same courses. i. Select name,course,semester from student as s Inner join admission as a where s.roll_number =a.roll_no; ii. Select name from student where roll_number IN (Select roll_no from admission as a Inner Join faculty f where faculty=’Ms. Sheela’ ); iii. Select faculty from Faculty where course IN(select course from Admission where roll_no IN(Select roll_number from student where name=’abhishek’))); iv. Select course from Admission where roll_no IN (select roll_number from student where name=’Asim’); v. Select name from student join Admission on student.roll_numer=Admission.roll_no Group By course;