This document provides an introduction to various SQL concepts including set operations, aggregates, nested subqueries, modification of databases, join expressions, and views. It covers topics such as union, intersect, except operations; aggregate functions like avg, min, max, sum, count; group by and having clauses; null values; correlated and non-correlated subqueries; exists, not exists, unique constructs; subqueries in the from clause; and the with clause. Examples are provided to illustrate each concept.
The document discusses relational algebra and tuple relational calculus. It defines the basic operators of relational algebra including selection, projection, union, difference, Cartesian product, and rename. It provides examples of how to write queries using each operator. It also discusses tuple relational calculus, defining domains, predicates, quantifiers, and how to write safe queries using this calculus.
At the end of this lecture students should be able to;
Describe the C arrays.
Practice the declaration, initialization and access linear arrays.
Practice the declaration, initialization and access two dimensional arrays.
Apply taught concepts for writing programs.
The document discusses various operations that can be performed on arrays, including traversing, inserting, searching, deleting, merging, and sorting elements. It provides examples and algorithms for traversing an array, inserting and deleting elements, and merging two arrays. It also discusses two-dimensional arrays and how to store user input data in a 2D array. Limitations of arrays include their fixed size and issues with insertion/deletion due to shifting elements.
This document contains the solutions to 8 questions related to Java OOP concepts such as inheritance, polymorphism, method overriding and overloading.
The questions cover topics like determining the output of sample code, identifying true/false statements about OOP concepts, explaining the differences between method overriding and overloading, designing UML class diagrams to model relationships between classes, and writing Java programs to test class hierarchies and subclasses.
Detailed explanations and code samples are provided for each question to demonstrate concepts like invoking superclass constructors, determining pass/fail conditions for student grades based on average test scores, implementing abstract classes and interfaces, and creating subclasses that extend the functionality of base classes.
This document contains instructions for a lab assignment on object-oriented programming using generic programming in Java. It includes 4 questions to design classes for Person, Student, Employee, Faculty and Staff with inheritance and polymorphism. The questions involve drawing UML diagrams, implementing the classes, writing test programs, and explaining the advantage of polymorphism. Students are instructed to submit their source code, UML diagram and output by a specified date.
This document provides an introduction and overview of inheritance in C#, including:
- Inheritance allows classes to extend existing classes, inheriting members and behavior
- Derived classes can call base class constructors via the base keyword
- The protected keyword controls accessibility for inherited members
- Virtual and override enable dynamic binding and polymorphism by allowing derived classes to override base class methods
- Abstract classes define common interfaces for derived classes to implement
The document discusses various programming concepts including variables, constants, operators, and data types. It defines constants as values that do not change during program execution. It describes different types of operators - arithmetic, logical, and relational - and provides examples of their usage. It also covers operator precedence and expressions. The learning objectives are to define constants, explain operators and their usage, and learn how to use relational and logical operators.
The document discusses various programming concepts including constants, variables, operators, and data types. It provides examples of naming conventions for variables and different types of operators used in programming like arithmetic, logical, and relational operators. It also defines key terms like operands, expressions, and precedence of operators.
The document discusses relational algebra and tuple relational calculus. It defines the basic operators of relational algebra including selection, projection, union, difference, Cartesian product, and rename. It provides examples of how to write queries using each operator. It also discusses tuple relational calculus, defining domains, predicates, quantifiers, and how to write safe queries using this calculus.
At the end of this lecture students should be able to;
Describe the C arrays.
Practice the declaration, initialization and access linear arrays.
Practice the declaration, initialization and access two dimensional arrays.
Apply taught concepts for writing programs.
The document discusses various operations that can be performed on arrays, including traversing, inserting, searching, deleting, merging, and sorting elements. It provides examples and algorithms for traversing an array, inserting and deleting elements, and merging two arrays. It also discusses two-dimensional arrays and how to store user input data in a 2D array. Limitations of arrays include their fixed size and issues with insertion/deletion due to shifting elements.
This document contains the solutions to 8 questions related to Java OOP concepts such as inheritance, polymorphism, method overriding and overloading.
The questions cover topics like determining the output of sample code, identifying true/false statements about OOP concepts, explaining the differences between method overriding and overloading, designing UML class diagrams to model relationships between classes, and writing Java programs to test class hierarchies and subclasses.
Detailed explanations and code samples are provided for each question to demonstrate concepts like invoking superclass constructors, determining pass/fail conditions for student grades based on average test scores, implementing abstract classes and interfaces, and creating subclasses that extend the functionality of base classes.
This document contains instructions for a lab assignment on object-oriented programming using generic programming in Java. It includes 4 questions to design classes for Person, Student, Employee, Faculty and Staff with inheritance and polymorphism. The questions involve drawing UML diagrams, implementing the classes, writing test programs, and explaining the advantage of polymorphism. Students are instructed to submit their source code, UML diagram and output by a specified date.
This document provides an introduction and overview of inheritance in C#, including:
- Inheritance allows classes to extend existing classes, inheriting members and behavior
- Derived classes can call base class constructors via the base keyword
- The protected keyword controls accessibility for inherited members
- Virtual and override enable dynamic binding and polymorphism by allowing derived classes to override base class methods
- Abstract classes define common interfaces for derived classes to implement
The document discusses various programming concepts including variables, constants, operators, and data types. It defines constants as values that do not change during program execution. It describes different types of operators - arithmetic, logical, and relational - and provides examples of their usage. It also covers operator precedence and expressions. The learning objectives are to define constants, explain operators and their usage, and learn how to use relational and logical operators.
The document discusses various programming concepts including constants, variables, operators, and data types. It provides examples of naming conventions for variables and different types of operators used in programming like arithmetic, logical, and relational operators. It also defines key terms like operands, expressions, and precedence of operators.
This document provides an introduction to creating and using classes in C#. Key points covered include defining classes with fields, methods, and constructors; using accessibility modifiers like public and private; calling methods and using the this keyword; creating static methods; and using listboxes, comboboxes, and events for selection changes. Examples are provided for defining classes, constructors, static and instance methods, and populating and accessing selection properties of list and combo boxes.
The document discusses one-dimensional and two-dimensional arrays in C++. It defines an array as a series of elements of the same type that allows storing multiple values of that type. For one-dimensional arrays, it covers declaring, initializing, and accessing arrays using indexes. Two-dimensional arrays are defined as arrays of arrays, representing a table with rows and columns where each element is accessed using row and column indexes. The document provides examples of declaring, initializing, and accessing elements in one-dimensional and two-dimensional arrays in C++.
The document discusses various aspects of arrays in C programming language. It defines arrays as collections of similar data types stored in contiguous memory locations. It describes single dimensional and multi-dimensional arrays. It also discusses array declaration and initialization syntax. Some key points covered are: advantages of arrays over single variables, accessing array elements using indexes, passing arrays to functions, and two dimensional or 2D arrays also called matrices.
The document discusses various object-oriented programming concepts in C#, including abstraction, encapsulation, inheritance, polymorphism, interfaces, abstract classes, virtual methods, classes, sealed classes, and provides code examples for foreach loops, switch statements, arrays, data types, boxing and unboxing, overloading and overriding, interfaces, classes vs. structures, access modifiers, abstract classes, and sealed classes.
The document discusses arrays and two-dimensional arrays in C programming. It defines arrays as collections of similar data elements stored in consecutive memory locations that can be accessed using an index. The key points are:
1) Arrays are declared with a type, name, and size and elements are accessed using indexes.
2) Two-dimensional arrays use two indexes to access elements, representing rows and columns.
3) Arrays can be initialized manually or by inputting values in a loop.
4) Pointers and addresses can be used to access and pass array elements between functions.
This document discusses polymorphism, abstract classes, and abstract methods. It defines polymorphism as an object's ability to take on many forms and describes how it allows reference variables to refer to objects of child classes. It also distinguishes between method overloading and overriding, and explains the rules for each. Abstract classes are introduced as classes that cannot be instantiated directly but can be inherited from, and it is noted they may or may not contain abstract methods.
Arrays & Strings can be summarized as follows:
1. Arrays are fixed-size collections of elements of the same data type that are used to store lists of related data. They can be one-dimensional, two-dimensional, or multi-dimensional.
2. Strings in C are arrays of characters terminated by a null character. They are commonly used to store text data. Common string operations include reading, writing, combining, copying, comparing, and extracting portions of strings.
3. Arrays are declared with a data type, name, and size. They can be initialized with a block of comma-separated values. Individual elements are accessed using indexes in square brackets. Two-dimensional arrays represent tables
This document discusses Java data types, variables, and methods. It covers primitive data types like int, float, and boolean. It describes rules for identifiers and conventions for naming variables and classes. The document defines parameter types, implicit and explicit parameters, and how to call methods. It explains constructing objects with the new operator and accessor and mutator methods. The summary concludes with a discussion of static methods and how to call them without an object.
The document discusses various operations that can be performed on strings in C language such as reading, writing, comparing, reversing, extracting substrings, concatenating, appending and inserting strings. It provides algorithms to implement these string operations using functions like scanf(), printf(), gets(), puts() and by manipulating the characters in the string using indexes. The key string operations covered are reading/writing strings, calculating string length, converting case, concatenating, comparing, reversing and extracting substrings from different positions in a string.
The document discusses three exercises related to data mining and machine learning algorithms:
1. Drawing a decision tree corresponding to a logical formula in disjunctive normal form about loan eligibility.
2. Calculating the information gain of attributes to determine the best attribute to use for the first branch in a decision tree.
3. Providing an example of when a decision tree would overfit the training data by perfectly modeling unique observations but being unable to generalize to new data.
The document discusses various concepts in data mining and decision trees including:
1) Pruning trees to address overfitting and improve generalization,
2) Separating data into training, development and test sets to evaluate model performance,
3) Information gain favoring attributes with many values by having less entropy,
4) Strategies for dealing with missing attribute values such as predicting values or focusing on other attributes/classes,
5) Changing stopping conditions for regression trees to use standard deviation thresholds rather than discrete classes.
The document discusses different types of operators in programming languages like C and C++. It explains that operators take operands as inputs and produce outputs. Common operators covered include arithmetic operators (+, -, *, /, %), unary operators (+, -), increment/decrement operators (++, --), relational operators (<, >, <=, >=, ==, !=), logical operators (&&, ||, !), and others. Examples are provided to demonstrate the usage of each operator. The key purpose of operators is to perform computations on operands through expressions.
The document discusses relational algebra and its operations. It begins with an introduction to relational algebra, noting that it is a collection of operations performed on relations that result in another relation. It then discusses some examples of set operations like union, intersection, difference performed on sample tables. It also discusses unary operations like selection and projection, providing examples. It describes join operations that combine two tables. It concludes with discussing aggregate functions that can be applied to columns and rows.
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Arrays in Java” will talk about one of the pillars of Java fundamentals i.e Arrays. It will also take you through the various types of arrays in Java and how they are used to achieve various functionalities. Through this tutorial, you will learn the following topics:
1. Arrays in Java
2. Types of Arrays
3. Working with Arrays
4. Sorting in Arrays
5. Searching in Arrays
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Object Oriented Programming using C++ Part IIIAjit Nayak
The document discusses inheritance in object-oriented programming. It defines inheritance as a technique where a new subclass inherits attributes and behaviors from an existing superclass without needing to redefine them. This allows code reuse and reduces development costs. The document provides examples of single inheritance with classes like Employee and Manager, and multi-level inheritance with Student, Test, and Result classes. It also discusses polymorphism through method overriding and different types of inheritance like public, private and protected.
Arrays allow storing and accessing multiple data elements using numeric indices. Arrays can be one-dimensional or multidimensional. One-dimensional arrays are linear arrays while multidimensional arrays include jagged arrays where each sub-array can have a different length. Arrays are declared using keywords like Dim and can be reinitialized using ReDim which resizes the array. Control structures like If/Then, Do/Loop, and For/Next are used to control program flow.
This document provides an overview of function notation and how to work with functions. It defines what a function is as a relation that assigns a single output value to each input value. It shows how functions can be represented using standard notation like f(x) and discusses evaluating functions by inputting values. Examples are provided of determining if a relationship represents a function, evaluating functions from tables and graphs, and solving functional equations.
Here are the function definitions and declarations to transfer the variables and arrays between main and the function as specified:
(a)
float func1(float a, float b, int jstar[20]) {
float x;
// function body
return x;
}
int main() {
float a, b;
int jstar[20];
float x = func1(a, b, jstar);
}
(b)
float func2(int n, char c, double values[50]) {
float x;
// function body
return x;
}
int main() {
int n;
char c;
double values[50
The document introduces common data types in SQL such as char, varchar, int, numeric, and date. It describes how to create databases and tables using SQL statements like CREATE DATABASE, CREATE TABLE, INSERT INTO, and ALTER TABLE. It also covers SQL queries using SELECT, FROM, WHERE, ORDER BY, LIKE and other clauses to retrieve and filter data from one or more tables.
This document discusses different types of joins in SQL, including:
1) Equijoins to retrieve records that match between two tables using column equality.
2) Nonequijoins using operators like BETWEEN to join on non-equal columns.
3) Outer joins to return both matching and non-matching record results from the left or right tables.
4) Self-joins to join a table to itself.
5) Cross joins to generate the Cartesian product between two tables without a join condition.
MySQL is an SQL-based relational database management system that is compatible with standard SQL. SQL is used for data definition and modification. Data definition statements like CREATE DATABASE and CREATE TABLE are used to define the schema. Data modification statements like INSERT, UPDATE, and DELETE are used to add, modify, and remove data from tables. Queries use SELECT statements to retrieve data from one or more tables, along with WHERE and JOIN clauses to filter rows and aggregate functions to perform calculations on groups of data.
This document provides an introduction to creating and using classes in C#. Key points covered include defining classes with fields, methods, and constructors; using accessibility modifiers like public and private; calling methods and using the this keyword; creating static methods; and using listboxes, comboboxes, and events for selection changes. Examples are provided for defining classes, constructors, static and instance methods, and populating and accessing selection properties of list and combo boxes.
The document discusses one-dimensional and two-dimensional arrays in C++. It defines an array as a series of elements of the same type that allows storing multiple values of that type. For one-dimensional arrays, it covers declaring, initializing, and accessing arrays using indexes. Two-dimensional arrays are defined as arrays of arrays, representing a table with rows and columns where each element is accessed using row and column indexes. The document provides examples of declaring, initializing, and accessing elements in one-dimensional and two-dimensional arrays in C++.
The document discusses various aspects of arrays in C programming language. It defines arrays as collections of similar data types stored in contiguous memory locations. It describes single dimensional and multi-dimensional arrays. It also discusses array declaration and initialization syntax. Some key points covered are: advantages of arrays over single variables, accessing array elements using indexes, passing arrays to functions, and two dimensional or 2D arrays also called matrices.
The document discusses various object-oriented programming concepts in C#, including abstraction, encapsulation, inheritance, polymorphism, interfaces, abstract classes, virtual methods, classes, sealed classes, and provides code examples for foreach loops, switch statements, arrays, data types, boxing and unboxing, overloading and overriding, interfaces, classes vs. structures, access modifiers, abstract classes, and sealed classes.
The document discusses arrays and two-dimensional arrays in C programming. It defines arrays as collections of similar data elements stored in consecutive memory locations that can be accessed using an index. The key points are:
1) Arrays are declared with a type, name, and size and elements are accessed using indexes.
2) Two-dimensional arrays use two indexes to access elements, representing rows and columns.
3) Arrays can be initialized manually or by inputting values in a loop.
4) Pointers and addresses can be used to access and pass array elements between functions.
This document discusses polymorphism, abstract classes, and abstract methods. It defines polymorphism as an object's ability to take on many forms and describes how it allows reference variables to refer to objects of child classes. It also distinguishes between method overloading and overriding, and explains the rules for each. Abstract classes are introduced as classes that cannot be instantiated directly but can be inherited from, and it is noted they may or may not contain abstract methods.
Arrays & Strings can be summarized as follows:
1. Arrays are fixed-size collections of elements of the same data type that are used to store lists of related data. They can be one-dimensional, two-dimensional, or multi-dimensional.
2. Strings in C are arrays of characters terminated by a null character. They are commonly used to store text data. Common string operations include reading, writing, combining, copying, comparing, and extracting portions of strings.
3. Arrays are declared with a data type, name, and size. They can be initialized with a block of comma-separated values. Individual elements are accessed using indexes in square brackets. Two-dimensional arrays represent tables
This document discusses Java data types, variables, and methods. It covers primitive data types like int, float, and boolean. It describes rules for identifiers and conventions for naming variables and classes. The document defines parameter types, implicit and explicit parameters, and how to call methods. It explains constructing objects with the new operator and accessor and mutator methods. The summary concludes with a discussion of static methods and how to call them without an object.
The document discusses various operations that can be performed on strings in C language such as reading, writing, comparing, reversing, extracting substrings, concatenating, appending and inserting strings. It provides algorithms to implement these string operations using functions like scanf(), printf(), gets(), puts() and by manipulating the characters in the string using indexes. The key string operations covered are reading/writing strings, calculating string length, converting case, concatenating, comparing, reversing and extracting substrings from different positions in a string.
The document discusses three exercises related to data mining and machine learning algorithms:
1. Drawing a decision tree corresponding to a logical formula in disjunctive normal form about loan eligibility.
2. Calculating the information gain of attributes to determine the best attribute to use for the first branch in a decision tree.
3. Providing an example of when a decision tree would overfit the training data by perfectly modeling unique observations but being unable to generalize to new data.
The document discusses various concepts in data mining and decision trees including:
1) Pruning trees to address overfitting and improve generalization,
2) Separating data into training, development and test sets to evaluate model performance,
3) Information gain favoring attributes with many values by having less entropy,
4) Strategies for dealing with missing attribute values such as predicting values or focusing on other attributes/classes,
5) Changing stopping conditions for regression trees to use standard deviation thresholds rather than discrete classes.
The document discusses different types of operators in programming languages like C and C++. It explains that operators take operands as inputs and produce outputs. Common operators covered include arithmetic operators (+, -, *, /, %), unary operators (+, -), increment/decrement operators (++, --), relational operators (<, >, <=, >=, ==, !=), logical operators (&&, ||, !), and others. Examples are provided to demonstrate the usage of each operator. The key purpose of operators is to perform computations on operands through expressions.
The document discusses relational algebra and its operations. It begins with an introduction to relational algebra, noting that it is a collection of operations performed on relations that result in another relation. It then discusses some examples of set operations like union, intersection, difference performed on sample tables. It also discusses unary operations like selection and projection, providing examples. It describes join operations that combine two tables. It concludes with discussing aggregate functions that can be applied to columns and rows.
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Arrays in Java” will talk about one of the pillars of Java fundamentals i.e Arrays. It will also take you through the various types of arrays in Java and how they are used to achieve various functionalities. Through this tutorial, you will learn the following topics:
1. Arrays in Java
2. Types of Arrays
3. Working with Arrays
4. Sorting in Arrays
5. Searching in Arrays
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Object Oriented Programming using C++ Part IIIAjit Nayak
The document discusses inheritance in object-oriented programming. It defines inheritance as a technique where a new subclass inherits attributes and behaviors from an existing superclass without needing to redefine them. This allows code reuse and reduces development costs. The document provides examples of single inheritance with classes like Employee and Manager, and multi-level inheritance with Student, Test, and Result classes. It also discusses polymorphism through method overriding and different types of inheritance like public, private and protected.
Arrays allow storing and accessing multiple data elements using numeric indices. Arrays can be one-dimensional or multidimensional. One-dimensional arrays are linear arrays while multidimensional arrays include jagged arrays where each sub-array can have a different length. Arrays are declared using keywords like Dim and can be reinitialized using ReDim which resizes the array. Control structures like If/Then, Do/Loop, and For/Next are used to control program flow.
This document provides an overview of function notation and how to work with functions. It defines what a function is as a relation that assigns a single output value to each input value. It shows how functions can be represented using standard notation like f(x) and discusses evaluating functions by inputting values. Examples are provided of determining if a relationship represents a function, evaluating functions from tables and graphs, and solving functional equations.
Here are the function definitions and declarations to transfer the variables and arrays between main and the function as specified:
(a)
float func1(float a, float b, int jstar[20]) {
float x;
// function body
return x;
}
int main() {
float a, b;
int jstar[20];
float x = func1(a, b, jstar);
}
(b)
float func2(int n, char c, double values[50]) {
float x;
// function body
return x;
}
int main() {
int n;
char c;
double values[50
The document introduces common data types in SQL such as char, varchar, int, numeric, and date. It describes how to create databases and tables using SQL statements like CREATE DATABASE, CREATE TABLE, INSERT INTO, and ALTER TABLE. It also covers SQL queries using SELECT, FROM, WHERE, ORDER BY, LIKE and other clauses to retrieve and filter data from one or more tables.
This document discusses different types of joins in SQL, including:
1) Equijoins to retrieve records that match between two tables using column equality.
2) Nonequijoins using operators like BETWEEN to join on non-equal columns.
3) Outer joins to return both matching and non-matching record results from the left or right tables.
4) Self-joins to join a table to itself.
5) Cross joins to generate the Cartesian product between two tables without a join condition.
MySQL is an SQL-based relational database management system that is compatible with standard SQL. SQL is used for data definition and modification. Data definition statements like CREATE DATABASE and CREATE TABLE are used to define the schema. Data modification statements like INSERT, UPDATE, and DELETE are used to add, modify, and remove data from tables. Queries use SELECT statements to retrieve data from one or more tables, along with WHERE and JOIN clauses to filter rows and aggregate functions to perform calculations on groups of data.
The document outlines SQL commands for creating and manipulating databases and tables, including creating and deleting databases and tables, inserting, updating, deleting and reading records from tables, and using clauses like WHERE, ORDER BY, GROUP BY and aggregate functions like COUNT, SUM, AVG, MIN, MAX. It also discusses set operations like UNION, INTERSECT, EXCEPT and using nested queries.
This document discusses advanced subquery techniques in SQL, including:
1) Writing multiple-column subqueries that can perform pairwise or nonpairwise comparisons.
2) Using scalar subqueries that return a single value in more clauses and expressions.
3) Writing correlated subqueries that are executed once per row to filter or update related data.
4) Using the EXISTS operator to check for matching rows in a subquery results set.
5) Leveraging the WITH clause to reuse query blocks and improve performance of complex queries.
Aggregate functions summarize data from multiple rows into a single value. They operate on a single column and return a single value. Common aggregate functions include SUM, AVG, MIN, MAX, and COUNT. SUM returns the sum of numeric column values. AVG returns the average of numeric column values. MIN and MAX return the minimum and maximum values in a column. COUNT returns the number of rows.
The document discusses various programming concepts including constants, variables, operators, and data types. It provides examples of naming conventions for variables and different types of operators used in programming like arithmetic, logical, and relational operators. It also defines key terms like operands, expressions, and precedence of operators.
The document defines key concepts in relational databases such as super keys, candidate keys, and primary keys. It provides an example table to demonstrate how these concepts apply. The document also lists some common relational algebra operations and provides examples of how they can be used to write queries on sample databases.
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxlynettearnold46882
DIRECTIONS: READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE ITS CONTENT. PLEASE CITE ALL REFERENCES
Katie Kessler
Unit 2 Discussion 1
Top of Form
The word “noir” is used to remember the scaling of measurement in psychology (Embretson, 2004). In short, the letters stand for nominal, ordinal, interval and ratio (Embretson, 2004). To give a brief introduction of what each scale measures, “nominal is the simplest way to measure” because it focuses on categorizing measurements on a scale of category, according to Embretson (2004). An example of nominal is eye color. “Ordinal measures in terms of ranking, interval measures scores of tests that focus on unobservable mental functioning and ratio focuses on measuring activities in the physical world, such as someone’s running time” (Embretson, 2004). With different scales of measurement, there are two methods to compare sets of data. These include norm-referenced and criterion-referenced testing. According to Embretson (2004) norm-referenced testing “yields information on a testtaker’s standing or ranking relative to some comparison group of testtakers.” In other words, it focuses on the performance of peers. Criterion-referenced testing is a little different because it focuses on examining individual’s scores to a set standard (Embretson, 2004).
The ability for ordinal measurement scale to be utilized on a standardized test as a norm-referenced test is high since an ordinal scale is based upon ranking and norm-referenced testing gathers information on the examinees ranking compared to a group of testtakers. For example, a study conducted on decision making with the use of ordinal variables states that ordinal measurement scales has the ability to be utilized by norm-referenced testing (Barua, Kademane, Das, Gubbiyappa, Verma, & Al-Dubai, 2014).On the other hand, ordinal scaling would not be a strong measurement for criterion-referenced testing because it focuses on the ranking rather than the measurement of the scores to be close to a set standard.
Ratio scaling directs its focus on measuring objects and activities in the physical world which would be beneficial for criterion-referenced testing instead of norm-referenced testing. Imagine a marathon runner who was trying to beat the world’s fastest time running a marathon. Criterion-referenced testing allows the runner to be aware of the set standard the marathon runner needs to beat to be the best and set a new standard. Norm-referenced testing would not be as useful because the marathon runner would not have the standard measurement he or she needs to beat. However, the marathon runner would be aware of the relative time he or she needs to beat to be the best. That is not as helpful as the criterion-referenced testing because runners need an exact number instead of a relative number in comparison to other runners.
Norm-referenced data would be collected by “the standards relative to a group, such as means and standard deviation.
The document provides guidelines for naming variables in programming. It recommends:
1. Avoiding confusing letters and numbers like 0 and O in variable names.
2. Using underscores instead of spaces in variable names.
3. Keeping variable names short for readability.
4. Being aware that case matters as uppercase and lowercase letters may represent different data.
This document provides an overview of querying and reporting in SQL, covering topics like arithmetic operators, built-in functions, selecting data, grouping results, joins, and subqueries. The agenda includes learning objectives, descriptions of SELECT statements, and explanations of concepts like aggregate functions, limiting results, sorting data, and correlating subqueries.
The document discusses relational algebra operations including selection, projection, join, union, intersection, difference, and cartesian product. It provides examples of how to write queries using these operations, such as selecting tuples that satisfy certain conditions, extracting certain attributes, combining relations, and performing joins between relations. Key operations like selection, projection, equijoin and natural join are explained in detail with examples.
This document provides an overview of Chapter 3 from the textbook "Database System Concepts, 6th Ed." by Silberschatz, Korth and Sudarshan. The chapter introduces SQL, including its history, data definition language, data types, basic query structure using SELECT, FROM, and WHERE clauses, and additional query capabilities like aggregation, subqueries and string operations. It also covers modifying the database using INSERT, DELETE, ALTER and DROP statements.
This document provides an overview of Chapter 3 from the textbook "Database System Concepts, 6th Ed." by Silberschatz, Korth and Sudarshan. It discusses the history and standards of SQL, the data definition language for creating tables with attributes and constraints, basic query structure using SELECT, FROM, and WHERE clauses, and examples of joins, renaming, and self joins.
This document provides an overview of Chapter 3 from the textbook "Database System Concepts, 6th Ed." by Silberschatz, Korth and Sudarshan. The chapter introduces SQL, including its history, data definition language, data types, basic query structure using SELECT, FROM, and WHERE clauses, and additional query capabilities like aggregation, subqueries, string operations and more. Examples are provided throughout to illustrate SQL concepts and syntax.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
An improved modulation technique suitable for a three level flying capacitor ...IJECEIAES
This research paper introduces an innovative modulation technique for controlling a 3-level flying capacitor multilevel inverter (FCMLI), aiming to streamline the modulation process in contrast to conventional methods. The proposed
simplified modulation technique paves the way for more straightforward and
efficient control of multilevel inverters, enabling their widespread adoption and
integration into modern power electronic systems. Through the amalgamation of
sinusoidal pulse width modulation (SPWM) with a high-frequency square wave
pulse, this controlling technique attains energy equilibrium across the coupling
capacitor. The modulation scheme incorporates a simplified switching pattern
and a decreased count of voltage references, thereby simplifying the control
algorithm.
Null Bangalore | Pentesters Approach to AWS IAMDivyanshu
#Abstract:
- Learn more about the real-world methods for auditing AWS IAM (Identity and Access Management) as a pentester. So let us proceed with a brief discussion of IAM as well as some typical misconfigurations and their potential exploits in order to reinforce the understanding of IAM security best practices.
- Gain actionable insights into AWS IAM policies and roles, using hands on approach.
#Prerequisites:
- Basic understanding of AWS services and architecture
- Familiarity with cloud security concepts
- Experience using the AWS Management Console or AWS CLI.
- For hands on lab create account on [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
# Scenario Covered:
- Basics of IAM in AWS
- Implementing IAM Policies with Least Privilege to Manage S3 Bucket
- Objective: Create an S3 bucket with least privilege IAM policy and validate access.
- Steps:
- Create S3 bucket.
- Attach least privilege policy to IAM user.
- Validate access.
- Exploiting IAM PassRole Misconfiguration
-Allows a user to pass a specific IAM role to an AWS service (ec2), typically used for service access delegation. Then exploit PassRole Misconfiguration granting unauthorized access to sensitive resources.
- Objective: Demonstrate how a PassRole misconfiguration can grant unauthorized access.
- Steps:
- Allow user to pass IAM role to EC2.
- Exploit misconfiguration for unauthorized access.
- Access sensitive resources.
- Exploiting IAM AssumeRole Misconfiguration with Overly Permissive Role
- An overly permissive IAM role configuration can lead to privilege escalation by creating a role with administrative privileges and allow a user to assume this role.
- Objective: Show how overly permissive IAM roles can lead to privilege escalation.
- Steps:
- Create role with administrative privileges.
- Allow user to assume the role.
- Perform administrative actions.
- Differentiation between PassRole vs AssumeRole
Try at [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...shadow0702a
This document serves as a comprehensive step-by-step guide on how to effectively use PyCharm for remote debugging of the Windows Subsystem for Linux (WSL) on a local Windows machine. It meticulously outlines several critical steps in the process, starting with the crucial task of enabling permissions, followed by the installation and configuration of WSL.
The guide then proceeds to explain how to set up the SSH service within the WSL environment, an integral part of the process. Alongside this, it also provides detailed instructions on how to modify the inbound rules of the Windows firewall to facilitate the process, ensuring that there are no connectivity issues that could potentially hinder the debugging process.
The document further emphasizes on the importance of checking the connection between the Windows and WSL environments, providing instructions on how to ensure that the connection is optimal and ready for remote debugging.
It also offers an in-depth guide on how to configure the WSL interpreter and files within the PyCharm environment. This is essential for ensuring that the debugging process is set up correctly and that the program can be run effectively within the WSL terminal.
Additionally, the document provides guidance on how to set up breakpoints for debugging, a fundamental aspect of the debugging process which allows the developer to stop the execution of their code at certain points and inspect their program at those stages.
Finally, the document concludes by providing a link to a reference blog. This blog offers additional information and guidance on configuring the remote Python interpreter in PyCharm, providing the reader with a well-rounded understanding of the process.
Discover the latest insights on Data Driven Maintenance with our comprehensive webinar presentation. Learn about traditional maintenance challenges, the right approach to utilizing data, and the benefits of adopting a Data Driven Maintenance strategy. Explore real-world examples, industry best practices, and innovative solutions like FMECA and the D3M model. This presentation, led by expert Jules Oudmans, is essential for asset owners looking to optimize their maintenance processes and leverage digital technologies for improved efficiency and performance. Download now to stay ahead in the evolving maintenance landscape.
2. Roadmap to This Lecture
Set operations
Aggregates
Nested Subqueries
Modification of the Database
Join Expressions
Views
2
3. Set Operations
Find courses that ran in Fall 2009 or in Spring 2010
Find courses that ran in Fall 2009 but not in Spring 2010
(select course_id from section where sem = ‘Fall’ and year = 2009)
union
(select course_id from section where sem = ‘Spring’ and year = 2010)
Find courses that ran in Fall 2009 and in Spring 2010
(select course_id from section where sem = ‘Fall’ and year = 2009)
intersect
(select course_id from section where sem = ‘Spring’ and year = 2010)
(select course_id from section where sem = ‘Fall’ and year = 2009)
except
(select course_id from section where sem = ‘Spring’ and year = 2010)
3
4. Set Operations
Set operations union, intersect, and except
Each of the above operations automatically eliminates duplicates
To retain all duplicates use the corresponding multiset versions union
all, intersect all and except all.
Suppose a tuple occurs m times in r and n times in s, then, it occurs:
m + n times in r union all s
min(m,n) times in r intersect all s
max(0, m – n) times in r except all s
4
5. Null Values
It is possible for tuples to have a null value, denoted by null, for some
of their attributes
null signifies an unknown value or that a value does not exist.
The result of any arithmetic expression involving null is null
Example: 5 + null returns null
The predicate is null can be used to check for null values.
Example: Find all instructors whose salary is null.
select name
from instructor
where salary is null
5
6. Null Values and Three Valued Logic
Any comparison with null returns unknown
Example: 5 < null or null <> null or null = null
Three-valued logic using the truth value unknown:
OR: (unknown or true) = true,
(unknown or false) = unknown
(unknown or unknown) = unknown
AND: (true and unknown) = unknown,
(false and unknown) = false,
(unknown and unknown) = unknown
NOT: (not unknown) = unknown
“P is unknown” evaluates to true if predicate P evaluates to
unknown
Result of where clause predicate is treated as false if it evaluates to
unknown
6
7. Aggregate Functions
These functions operate on the multiset of values of a column of
a relation, and return a value
avg: average value
min: minimum value
max: maximum value
sum: sum of values
count: number of values
7
8. Aggregate Functions (Cont.)
Find the average salary of instructors in the Computer Science
department
select avg (salary)
from instructor
where dept_name= ’Comp. Sci.’;
Find the total number of instructors who teach a course in the Spring
2010 semester
select count (distinct ID)
from teaches
where semester = ’Spring’ and year = 2010;
Find the number of tuples in the course relation
select count (*)
from course;
8
9. Aggregate Functions – Group By
Find the average salary of instructors in each department
select dept_name, avg (salary) as avg_salary
from instructor
group by dept_name;
avg_salary
9
10. Aggregation (Cont.)
Attributes in select clause outside of aggregate functions must appear
in group by list
/* erroneous query */
select dept_name, ID, avg (salary)
from instructor
group by dept_name;
Reason is simple: ID has different values in each group of
dept_name, so which ID shall we return along with the average
salary?
10
11. Aggregate Functions – Having Clause
Find the names and average salaries of all departments whose
average salary is greater than 42000
Note: predicates in the having clause are applied after the
formation of groups whereas predicates in the where
clause are applied before forming groups
select dept_name, avg (salary)
from instructor
group by dept_name
having avg (salary) > 42000;
11
12. Null Values and Aggregates
Total all salaries
select sum (salary )
from instructor
Above statement ignores null amounts
Result is null if there is no non-null amount
All aggregate operations except count(*) ignore tuples with null values
on the aggregated attributes
What if collection has only null values?
count returns 0
all other aggregates return null
12
14. Nested Subqueries
SQL provides a mechanism for the nesting of subqueries.
A subquery is a select-from-where expression that is nested within
another query.
A common use of subqueries is to perform tests for set membership, set
comparisons, and set cardinality.
14
15. Example Query
Find courses offered in Fall 2009 and in Spring 2010
Find courses offered in Fall 2009 but not in Spring 2010
select distinct course_id
from section
where semester = ’Fall’ and year= 2009 and
course_id in (select course_id
from section
where semester = ’Spring’ and year= 2010);
select distinct course_id
from section
where semester = ’Fall’ and year= 2009 and
course_id not in (select course_id
from section
where semester = ’Spring’ and year= 2010);
15
16. Example Query
Find the total number of (distinct) students who have taken course
sections taught by the instructor with ID 10101
Note: Above query can be written in a much simpler manner. The
formulation above is simply to illustrate SQL features.
select count (distinct ID)
from takes
where (course_id, sec_id, semester, year) in
(select course_id, sec_id, semester, year
from teaches
where teaches.ID= 10101);
16
17. Set Comparison
Find names of instructors with salary greater than that of some (at
least one) instructor in the Biology department.
Same query using > some clause
select name
from instructor
where salary > some (select salary
from instructor
where dept name = ’Biology’);
select distinct T.name
from instructor as T, instructor as S
where T.salary > S.salary and S.dept name = ’Biology’;
17
18. Definition of Some Clause
F <comp> some r t r such that (F <comp> t )
Where <comp> can be:
0
5
6
(5 < some ) = true
0
5
0
) = false
5
0
5
(5 some ) = true (since 0 5)
(read: 5 < some tuple in the relation)
(5 < some
) = true
(5 = some
(= some) in
However, ( some) ≠ not in
18
19. Example Query
Find the names of all instructors whose salary is greater than the
salary of all instructors in the Biology department.
select name
from instructor
where salary > all (select salary
from instructor
where dept name = ’Biology’);
19
20. Definition of all Clause
F <comp> all r t r (F <comp> t)
0
5
6
(5 < all ) = false
6
10
4
) = true
5
4
6
(5 all ) = true (since 5 4 and 5 6)
(5 < all
) = false
(5 = all
( all) not in
However, (= all) ≠ in
20
21. Test for Empty Relations
The exists construct returns the value true if the argument subquery is
nonempty.
exists r r Ø
not exists r r = Ø
21
22. Correlation Variables
Yet another way of specifying the query “Find all courses taught in
both the Fall 2009 semester and in the Spring 2010 semester”
select course_id
from section as S
where semester = ’Fall’ and year = 2009 and
exists (select *
from section as T
where semester = ’Spring’ and year= 2010
and S.course_id = T.course_id);
Correlated subquery
Correlation name or correlation variable
Scope of variables restricted to the inner-most query structure that
defines them
22
23. Not Exists
Find all students who have taken all courses offered in the Biology
department.
select distinct S.ID, S.name
from student as S
where not exists ( (select course_id
from course
where dept_name = ’Biology’)
except
(select T.course_id
from takes as T
where S.ID = T.ID));
• First nested query lists all courses offered in Biology
• Second nested query lists all courses a particular student took
Note that X – Y = Ø X Y (set containment)
Note: Cannot write this query using = all or its variants
23
24. Test for Absence of Duplicate Tuples
The unique construct tests whether a subquery has any duplicate tuples
in its result.
The unique construct evaluates to “true” on an empty set.
Find all courses that were offered at most once in 2009
select T.course_id
from course as T
where unique (select R.course_id
from section as R
where T.course_id= R.course_id
and R.year = 2009);
24
25. Subqueries in the From Clause
SQL allows a subquery expression to be used in the from clause
Find the average instructors’ salaries of those departments where the
average salary is greater than $42,000.
select dept_name, avg_salary
from (select dept_name, avg (salary) as avg_salary
from instructor
group by dept_name)
where avg_salary > 42000;
The above eliminate the need to use the having clause
Another way to write above query
select dept_name, avg_salary
from (select dept_name, avg (salary)
from instructor
group by dept_name) as dept_avg (dept_name, avg_salary)
where avg_salary > 42000;
25
26. Subqueries in the From Clause (Cont.)
Sub-queries in the from clause normally can’t access variables from
other attributes of the relations in the from clause
And yet another way to write it: lateral clause
Return instructor’s name, his or her salary and the average salary of
his or her department:
select name, salary, avg_salary
from instructor I1,
lateral (select avg(salary) as avg_salary
from instructor I2
where I2.dept_name= I1.dept_name);
Note: lateral is part of the SQL standard, but is not supported on many
database systems; some databases such as SQL Server offer
alternative syntax
26
27. With Clause
The with clause provides a way of defining a temporary relation
whose definition is available only to the query in which the with
clause occurs.
Find all departments with the maximum budget
with max_budget (value) as
(select max(budget)
from department)
select department.dept_name
from department, max_budget
where department.budget = max_budget.value;
You can think of with clause as declaration of local variables and
assigning values to them
27
28. Complex Queries using With Clause
Find all departments where the total salary is greater than the
average of the total salary at all departments
Write it without the with clause?
with dept _total (dept_name, value) as
(select dept_name, sum(salary)
from instructor
group by dept_name),
dept_total_avg(value) as
(select avg(value)
from dept_total)
select dept_name
from dept_total, dept_total_avg
where dept_total.value >= dept_total_avg.value;
28
29. Scalar Subquery
Scalar subquery is one which is used where a single value (tuple)
is expected
select dept_name,
(select count(*)
from instructor
where department.dept_name = instructor.dept_name)
as num_instructors
from department;
What does this query do?
Variables in the select clause must be scale value
Runtime error if subquery returns more than one result tuple
29
30. Modification of the Database
Deletion of tuples from a given relation.
Insertion of new tuples into a given relation
Updating of values in some tuples in a given relation
30
31. Deletion
Delete all instructors
delete from instructor
Delete all instructors from the Finance department
delete from instructor
where dept_name= ’Finance’;
Delete all tuples in the instructor relation for those instructors
associated with a department located in the Watson building.
delete from instructor
where dept_name in (select dept_name
from department
where building = ’Watson’);
31
32. Deletion (Cont.)
Delete all instructors whose salary is less than the average salary of
instructors
delete from instructor
where salary < (select avg (salary) from instructor);
Problem?
as we delete tuples from instructor table, the average salary changes
Solution used in SQL:
1. First, compute avg salary and find all tuples to delete
2. Next, delete all tuples found above (without
recomputing avg or retesting the tuples)
32
33. Insertion
Add a new tuple to course
insert into course
values (’CS-437’, ’Database Systems’, ’Comp. Sci.’, 4);
or equivalently
insert into course (course_id, title, dept_name, credits)
values (’CS-437’, ’Database Systems’, ’Comp. Sci.’, 4);
Add a new tuple to student with tot_creds set to null
insert into student
values (’3003’, ’Green’, ’Finance’, null);
33
34. Insertion (Cont.)
Add all instructors to the student relation with tot_creds set to 0
insert into student
select ID, name, dept_name, 0
from instructor
The select from where statement is evaluated fully before any of its
results are inserted into the relation.
Otherwise queries like
insert into table1 select * from table1
would cause problem
34
35. Updates
Increase salaries of instructors whose salary is over $100,000 by 3%,
and all others receive a 5% raise
Write two update statements:
update instructor
set salary = salary * 1.05
where salary <= 100000;
update instructor
set salary = salary * 1.03
where salary > 100000;
What’s the problem here?
The order is important
Can be done better using the case statement (next slide)
35
36. Case Statement for Conditional Updates
Same query as before but with case statement
update instructor
set salary = case
when salary <= 100000 then salary * 1.05
else salary * 1.03
end
36
37. Updates with Scalar Subqueries
Recompute and update tot_creds value for all students
update student S
set tot_cred = ( select sum(credits)
from takes natural join course
where S.ID= takes.ID and
takes.grade <> ’F’ and
takes.grade is not null);
The above sets tot_creds to null for students who have not
taken any course
Instead of sum(credits), use:
case
when sum(credits) is not null then sum(credits)
else 0
end
37
38. Joined Relations
Join operations take two relations and return as a result
another relation.
A join operation is a Cartesian product which requires that
tuples in the two relations match (under some condition).
It also specifies the attributes that are present in the result
of the join
The join operations are typically used as subquery
expressions in the from clause
38
39. Join operations – Example
Relation course
Relation prereq
Observe that
prereq information is missing for CS-315 and
course information is missing for CS-347 39
40. Joined Relations
Join operations take two relations and return as a result
another relation.
These additional operations are typically used as subquery
expressions in the from clause
Join condition – defines which tuples in the two relations
match, and what attributes are present in the result of the join.
Join type – defines how tuples in each relation that do not
match any tuple in the other relation (based on the join
condition) are treated.
40
41. Outer Join
An extension of the join operation that avoids loss of
information.
Computes the join and then adds tuples from one relation
that does not match tuples in the other relation to the result
of the join.
Uses null values.
41
45. Joined Relations in SQL – Examples
course inner join prereq on
course.course_id = prereq.course_id
What is the difference between the above and a natural
join?
Cartesian product with a selection condition
45
46. Joined Relations in SQL – Examples
course left outer join prereq on
course.course_id = prereq.course_id
46
47. Joined Relations – Examples
course natural right outer join prereq
course full outer join prereq using (course_id)
47
48. Views
In some cases, it is not desirable for all users to see the entire
logical model (that is, all the actual relations stored in the
database.)
Consider a person who needs to know an instructor’s name
and department, but not the salary. This person should see a
relation described, in SQL, by
select ID, name, dept_name
from instructor
A view provides a mechanism to hide certain data from the
view of certain users.
Any relation that is not of the conceptual model but is made
visible to a user as a “virtual relation” is called a view.
48
49. View Definition
A view is defined using the create view statement which has
the form
create view v as < query expression >
where <query expression> is any legal SQL expression. The
view name is represented by v.
Once a view is defined, the view name can be used to refer to
the virtual relation that the view generates.
View definition is not the same as creating a new relation by
evaluating the query expression
Rather, a view definition causes the saving of an expression;
the expression is substituted into queries using the view.
In programming language terms, this is “call by name” or
lazy evaluation!
49
50. Example Views
A view of instructors without their salary
create view faculty as
select ID, name, dept_name
from instructor
A view of all instructors in the Biology department
create view bio_instructors as
select name
from faculty
where dept_name = ‘Biology’
Create a view of department salary totals
create view departments_total_salary(dept_name, total_salary) as
select dept_name, sum (salary)
from instructor
group by dept_name;
50
51. Views Defined Using Other Views
create view physics_fall_2009 as
select course.course_id, sec_id, building, room_number
from course, section
where course.course_id = section.course_id
and course.dept_name = ’Physics’
and section.semester = ’Fall’
and section.year = ’2009’;
create view physics_fall_2009_watson as
select course_id, room_number
from physics_fall_2009
where building= ’Watson’;
51
52. View Expansion
Expand use of a view (physics_fall_2009) in a query/another view
create view physics_fall_2009_watson as
(select course_id, room_number
from (select course.course_id, building, room_number
from course, section
where course.course_id = section.course_id
and course.dept_name = ’Physics’
and section.semester = ’Fall’
and section.year = ’2009’)
where building= ’Watson’;)
52
53. Views Defined Using Other Views
One view may be used in the expression defining another view
A view relation v1 is said to depend directly on a view relation
v2 if v2 is used in the expression defining v1
A view relation v1 is said to depend on view relation v2 if either
v1 depends directly to v2 or there is a path of dependencies
from v1 to v2
A view relation v is said to be recursive if it depends on itself.
53
54. View Expansion
A way to define the meaning of views defined in terms of other
views.
Let view v1 be defined by an expression e1 that may itself
contain uses of view relations.
View expansion of an expression repeats the following
replacement step:
repeat
Find any view relation vi in e1
Replace the view relation vi by the expression defining vi
until no more view relations are present in e1
As long as the view definitions are not recursive, this loop will
terminate
54
55. Update of a View
Add a new tuple to faculty view which we defined earlier
insert into faculty values (’30765’, ’Green’, ’Music’);
This insertion must be represented by the insertion of the tuple
(’30765’, ’Green’, ’Music’, null)
into the instructor relation
55
56. Some Updates cannot be Translated Uniquely
create view instructor_info as
select ID, name, building
from instructor, department
where instructor.dept_name= department.dept_name;
insert into instructor_info values (’69987’, ’White’, ’Taylor’);
which department, if multiple departments in Taylor?
what if no department is in Taylor?
Most SQL implementations allow updates only on simple views
The from clause has only one database relation.
The select clause contains only attribute names of the
relation, and does not have any expressions, aggregates, or
distinct specification.
Any attribute not listed in the select clause can be set to null
The query does not have a group by or having clause.
56
57. More Problems
create view history_instructors as
select *
from instructor
where dept_name= ’History’;
What happens if we insert (’25566’, ’Brown’, ’Biology’, 100000)
into history_instructors?
57
58. Materialized Views
When defining a view, simply create a physical table
representing the view at the time of creation.
Update is simple to handle.
How are updates handled to the “base” relations on which
the view was defined?
58