The document provides an introduction to SQL (Structured Query Language). It discusses the history and evolution of SQL standards. SQL is introduced as the most widely used and accepted language for managing data in relational database management systems. The key benefits of SQL and its role in creating, querying, updating and managing relational databases are described. Common SQL commands like CREATE, ALTER, DROP, INSERT, SELECT, UPDATE, DELETE are explained. Additional topics covered include functions, joins, subqueries and other advanced SQL features.
Les09 (using ddl statements to create and manage tables)Achmad Solichin
Using DDL Statements to Create and Manage Tables
The document discusses using DDL statements to create and manage database tables. It covers categorizing database objects like tables, views, indexes, and sequences. It also covers the syntax for creating tables, specifying column names and data types, creating constraints, and dropping tables. Examples are provided for creating a simple table, adding constraints, creating a table using a subquery, and altering or dropping existing tables.
The document provides an overview of SQL and database implementation. It discusses SQL environments, data types, database definition using DDL statements to create tables and views, and DML statements for data manipulation including SELECT, INSERT, UPDATE, DELETE. Examples are provided for each statement type. The SELECT statement is discussed in more depth, with examples demonstrating clauses like WHERE, ORDER BY, GROUP BY, HAVING, functions and operators.
Using DDL Statements to Create and Manage Tables
This document discusses using data definition language (DDL) statements to create and manage database tables. It covers categorizing database objects like tables, views, and indexes; defining table structures with columns and data types; creating tables with the CREATE TABLE statement; adding constraints at table creation; and dropping tables with DROP TABLE. The key topics are creating simple tables, understanding available data types, defining columns and constraints, and using DDL statements like CREATE TABLE, ALTER TABLE, and DROP TABLE to manage tables.
This document provides information about SQL and database management systems. It discusses:
- SQL is a standard language for querying, manipulating, and defining data in databases. It was developed by IBM in the 1970s.
- SQL can be used to perform functions like retrieving data from a database, inserting new records, updating existing records, and deleting records.
- The main components of SQL are DDL, DML, DCL, and DQL which allow creating, modifying and deleting database structures, manipulating data, controlling access to data, and querying data respectively.
- Common SQL statements are discussed including SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE TABLE, and DROP TABLE. Data types and
This document provides an introduction and overview of databases and the basic operations used to manage data in a database using Microsoft Access 2007. It defines what a database is, how data is organized in tables with rows and columns, and when it is appropriate to use a database. It also outlines and provides examples of the basic CRUD (create, read, update, delete) operations used in structured query language (SQL) to manipulate data, including inserting, selecting, updating, and deleting records from database tables.
This document provides an introduction to SQL (Structured Query Language). SQL is a language used to define, query, modify, and control relational databases. The document outlines the main SQL commands for data definition (CREATE, ALTER, DROP), data manipulation (INSERT, UPDATE, DELETE), and data control (GRANT, REVOKE). It also discusses SQL data types, integrity constraints, and how to use SELECT statements to query databases using projections, selections, comparisons, logical conditions, and ordering. The FROM clause is introduced as specifying the relations involved in a query.
The document provides an overview of SQL and the database development process. It discusses SQL standards and environments. It also demonstrates how to define databases and tables using SQL data definition language. Examples are provided for SQL statements like SELECT, INSERT, UPDATE, and DELETE to manipulate and query data. Views, functions, joins and other SQL features are also explained.
Les09 (using ddl statements to create and manage tables)Achmad Solichin
Using DDL Statements to Create and Manage Tables
The document discusses using DDL statements to create and manage database tables. It covers categorizing database objects like tables, views, indexes, and sequences. It also covers the syntax for creating tables, specifying column names and data types, creating constraints, and dropping tables. Examples are provided for creating a simple table, adding constraints, creating a table using a subquery, and altering or dropping existing tables.
The document provides an overview of SQL and database implementation. It discusses SQL environments, data types, database definition using DDL statements to create tables and views, and DML statements for data manipulation including SELECT, INSERT, UPDATE, DELETE. Examples are provided for each statement type. The SELECT statement is discussed in more depth, with examples demonstrating clauses like WHERE, ORDER BY, GROUP BY, HAVING, functions and operators.
Using DDL Statements to Create and Manage Tables
This document discusses using data definition language (DDL) statements to create and manage database tables. It covers categorizing database objects like tables, views, and indexes; defining table structures with columns and data types; creating tables with the CREATE TABLE statement; adding constraints at table creation; and dropping tables with DROP TABLE. The key topics are creating simple tables, understanding available data types, defining columns and constraints, and using DDL statements like CREATE TABLE, ALTER TABLE, and DROP TABLE to manage tables.
This document provides information about SQL and database management systems. It discusses:
- SQL is a standard language for querying, manipulating, and defining data in databases. It was developed by IBM in the 1970s.
- SQL can be used to perform functions like retrieving data from a database, inserting new records, updating existing records, and deleting records.
- The main components of SQL are DDL, DML, DCL, and DQL which allow creating, modifying and deleting database structures, manipulating data, controlling access to data, and querying data respectively.
- Common SQL statements are discussed including SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE TABLE, and DROP TABLE. Data types and
This document provides an introduction and overview of databases and the basic operations used to manage data in a database using Microsoft Access 2007. It defines what a database is, how data is organized in tables with rows and columns, and when it is appropriate to use a database. It also outlines and provides examples of the basic CRUD (create, read, update, delete) operations used in structured query language (SQL) to manipulate data, including inserting, selecting, updating, and deleting records from database tables.
This document provides an introduction to SQL (Structured Query Language). SQL is a language used to define, query, modify, and control relational databases. The document outlines the main SQL commands for data definition (CREATE, ALTER, DROP), data manipulation (INSERT, UPDATE, DELETE), and data control (GRANT, REVOKE). It also discusses SQL data types, integrity constraints, and how to use SELECT statements to query databases using projections, selections, comparisons, logical conditions, and ordering. The FROM clause is introduced as specifying the relations involved in a query.
The document provides an overview of SQL and the database development process. It discusses SQL standards and environments. It also demonstrates how to define databases and tables using SQL data definition language. Examples are provided for SQL statements like SELECT, INSERT, UPDATE, and DELETE to manipulate and query data. Views, functions, joins and other SQL features are also explained.
This document provides an overview of a training course on basic SQL queries. The course objectives are to learn how to execute basic SELECT statements, restrict and sort query results, and use aggregation functions. The topics covered include the SELECT statement, comparison operators, logical operators, the ORDER BY clause, and substitution variables. The document provides examples of SQL syntax for each topic and explains how to use the iSQL*Plus tool to interact with database tables and run queries.
The document discusses SAS training which includes:
1) Reading data from raw data files, formatting the data, and performing statistical analysis and data manipulation.
2) Combining and subsetting different data sets.
3) Processing data iteratively through loops and producing final reports.
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.
DDL(Data defination Language ) Using OracleFarhan Aslam
The document discusses DDL and DCL commands in Oracle including naming rules for objects, data types, creating tables, constraints, defining constraints, updating and violating constraints, creating tables using subqueries, altering tables, views, sequences, granting and revoking privileges, and dropping tables. It also discusses the Oracle data dictionary.
The document provides an overview of key database concepts including:
- A database is a collection of logically related information stored and managed using database management system software.
- Relational databases organize data into tables with rows and columns and use keys to link related data across tables. Structured Query Language (SQL) is used to perform operations like data queries and manipulation.
- Database management involves tasks like defining the database structure with data definition language statements, manipulating data with data manipulation language statements, and running queries with the SELECT statement to retrieve and work with data in the database.
A talk given by Julian Hyde at DataCouncil SF on April 18, 2019
How do you organize your data so that your users get the right answers at the right time? That question is a pretty good definition of data engineering — but it is also describes the purpose of every DBMS (database management system). And it’s not a coincidence that these are so similar.
This talk looks at the patterns that reoccur throughout data management — such as caching, partitioning, sorting, and derived data sets. As the speaker is the author of Apache Calcite, we first look at these patterns through the lens of Relational Algebra and DBMS architecture. But then we apply these patterns to the modern data pipeline, ETL and analytics. As a case study, we look at how Looker’s “derived tables” blur the line between ETL and caching, and leverage the power of cloud databases.
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 describes the syntax for creating, altering, and dropping tables in SQL. It provides examples of creating tables with column constraints, default values, primary keys, foreign keys, and unique constraints. It also shows how to add, modify, and drop columns from existing tables using ALTER TABLE statements. The final sections cover DML statements for inserting, updating, deleting, and selecting data from tables.
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxchristinemaritza
Charles WilliamsCS362Unit 3 Discussion Board
Structured Query Language for Data Management 1
Structured Query Language for Data Management 36-04-17
Table of Contents
Phase 1- Database Design and DDL 3
Business Rules & Entity Tables 3
Entity Tables: 4
SQL CODE: 4
Screenshots: 8
Phase 2 – Security and DML 13
Task 1 14
Task 2 15
Task 3 16
Task 4 17
Task 5 18
Phase 3 - DML (Select) and Procedures 19
Task 1 19
Task 2 20
Task 3 21
Task 4 22
Task 5 23
Phase 4 – Architecture, Indexes 27
Step 1: CREATE TABLE [Degrees] 27
Step 2: Re-create ‘Classes’ TABLE to add ‘DegreeID’ column and INSERT 6 classes 29
Step 3: ALTER TABLE [Students] 31
Step 5: DML script to INSERT INTO the ‘Students’ table ‘DegreeID’ data 33
Step 6: Display ERD 36
Phase 5 – Views, Transactions, Testing and Performance 37
References 38
Phase 1- Database Design and DDL
I contracted to design and develop a database for CTU that will store individual and confidential university data. This database is required to give the back-end engineering to a front-end web application with an instinctive User/Interface (U/I) to be utilized by the college HR office. We've chosen to utilize Microsoft SQL Server 2012 given the way of information to be put away because it will be more secure, and it additionally gives a suite of server upkeep apparatuses to be deserted with the IT Department once the database and web application have been tried and acknowledged by college partners.
Amid our preparatory gatherings, CTU's necessities were characterized and enough perused to start making of the database. The accompanying areas contain the business tenets and element tables created amid the preparatory gatherings, and additionally duplicates of all the SQL code used to manufacture the database and make the Entity Relationship Diagram (ERD).
Business Rules & Entity Tables
Business Rules:
· A student has a name, a birth date, and gender.
· You must track the date the student started at the university and his or her current GPA, as well as be able to inactivate him or her without deleting information.
· For advising purposes, store the student's background/bio information. This is like a little story.
· An advisor has a name and an e-mail address.
· Students are assigned to one advisor, but one advisor may service multiple students.
· A class has a class code, name, and description.
· You need to indicate the specific classes a student is taking/has taken at the university. Track the date the student started a specific class and the grade earned in that class.
· Each class that a student takes has 4 assignments. Each assignment is worth 100 points.Entity Tables:
SQL CODE:
Create Database:
CREATE DATABASE [Cameron_CTU]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Cameron_CTU', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Cameron_CTU_log', FILENAME = N'c:\Progra ...
Structured Query Language for Data Management 2 Sructu.docxjohniemcm5zt
Structured Query Language for Data Management 2
Sructured Query Language for Data Management 6
Table of Contents
Phase 1- Database Design and DDL 3
Business Rules & Entity Tables 3
Entity Tables: 4
SQL CODE: 4
Screenshots: 8
Phase 2 – Security and DML 13
Task 1 14
Task 2 15
Task 3 16
Task 4 17
Task 5 18
Phase 3 - DML (Select) and Procedures 19
Task 1 19
Task 2 20
Task 3 21
Task 4 22
Task 5 23
Phase 4 – Architecture, Indexes 27
Step 1: CREATE TABLE [Degrees] 27
Step 2: Re-create ‘Classes’ TABLE to add ‘DegreeID’ column and INSERT 6 classes 29
Step 3: ALTER TABLE [Students] 31
Step 5: DML script to INSERT INTO the ‘Students’ table ‘DegreeID’ data 33
Step 6: Display ERD 36
Phase 5 – Views, Transactions, Testing and Performance 37
References 38
Phase 1- Database Design and DDL
My team was recently contracted to design and develop a database for CTU that will store personal and confidential university data. This database is expected to provide the back-end architecture for a front-end web application with an intuitive User/Interface (U/I) to be used by the university HR department. We’ve decided to use Microsoft SQL Server 2012 given the nature of data to be stored because it will be more secure, and it also provides a suite of server maintenance tools to be left behind with the IT Department once the database and web application have been tested and accepted by university stakeholders.
During our preliminary meetings, CTU’s requirements were defined and adequately scoped to begin creation of the database. The following sections contain the business rules and entity tables developed during the preliminary meetings, as well as copies of all the SQL code used to build the database and create the Entity Relationship Diagram (ERD). Business Rules & Entity Tables
Business Rules:
· A student has a name, a birth date, and gender.
· You must track the date the student started at the university and his or her current GPA, as well as be able to inactivate him or her without deleting information.
· For advising purposes, store the student's background/bio information. This is like a little story.
· An advisor has a name and an e-mail address.
· Students are assigned to one advisor, but one advisor may service multiple students.
· A class has a class code, name, and description.
· You need to indicate the specific classes a student is taking/has taken at the university. Track the date the student started a specific class and the grade earned in that class.
· Each class that a student takes has 4 assignments. Each assignment is worth 100 points.Entity Tables:
SQL CODE:
Create Database:
CREATE DATABASE [Cameron_CTU]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Cameron_CTU', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Cameron_CTU_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU_.
Pandas is a popular Python library for data analysis and manipulation. It allows users to import data from various sources like CSV, Excel, JSON, databases into DataFrames. DataFrames can then be queried, filtered, reshaped, inspected, and exported back into different formats. Some key operations include importing/exporting data, subsetting rows and columns, reshaping the layout, and aggregating/summarizing the data.
This document discusses various data definition language (DDL) statements in SQL. It describes DDL statements to create, modify, and delete database objects like schemas, tables, views, and indexes. Specifically, it covers the CREATE, ALTER, and DROP statements for schemas, tables, views, indexes, and constraints. Examples are provided for each statement type.
The document provides an overview of SQL (Structured Query Language), including its standards, environment, data types, DDL (Data Definition Language) for defining database schema, DML (Data Manipulation Language) for manipulating data, and DCL (Data Control Language) for controlling access. It discusses SQL statements for defining tables, inserting, updating, deleting, and querying data using SELECT statements with various clauses. Views are also introduced as virtual tables defined by a SELECT statement on base tables.
Getting started with Pandas Cheatsheet.pdfSudhakarVenkey
Pandas is a popular Python library for data wrangling and analysis that can handle various data formats like CSV, Excel, JSON, HTML, and SQL. It allows users to create DataFrames from dictionaries, lists, and by importing data from text, Excel files, websites, databases and JSON. DataFrames can be exported, inspected by viewing rows and columns, subsetted by selecting rows and columns, queried using logical conditions, and reshaped by changing layout, renaming columns, appending rows/columns, and sorting values.
Structured Query Language (SQL) is used to define, manipulate, and control data in a relational database. The document provides an overview of SQL, covering its main components like Data Definition Language (DDL) for defining tables, Data Manipulation Language (DML) for inserting, updating, deleting and selecting data, and Data Control Language (DCL) for controlling database privileges. It describes the basic DML commands, discusses integrity constraints and transactions, and shows how to perform single table and joined queries using SQL syntax.
The document provides an overview of SQL (Structured Query Language) including its purpose, benefits, and key components. It describes the SQL environment and data types, as well as the main SQL statements used for database definition (DDL), data manipulation (DML), and control (DCL). Examples are given for common statements like CREATE TABLE, SELECT, INSERT, UPDATE, DELETE, and how to define views, integrity controls, indexes and more.
This document provides an overview of relational databases and the Microsoft SQL Server database management system. It defines key concepts like tables, primary keys, and foreign keys. It also describes popular DBMSs, database structures in SQL Server like client/server and n-tier architectures, and how to create indexes, backups, restores, stored procedures, triggers, views, and functions. The document includes syntax examples and concludes with a reference section and questions.
The document discusses setting up MySQL, creating databases and tables, loading data from an SQL file, inserting records, and setting the MySQL JDBC driver to connect to the database from Java programs. Key steps include downloading and installing MySQL, creating a database called javabook and tables called Course, Student, and Enrollment, loading an SQL file to create the tables, inserting sample records, and setting the MySQL JDBC driver classpath to connect from Java.
Integration is the process of combining separate software components into a single system. There are two main approaches: phased integration, where all components are combined at once, and incremental integration, where components are added one at a time. Incremental integration makes it easier to locate bugs and improves progress monitoring. Specific incremental strategies include top-down, bottom-up, and feature-oriented integration. It is generally best to use a combination of approaches for a given project. Daily builds and smoke tests also help reduce integration issues.
The document provides information on various BPMN modeling concepts including pools, lanes, orchestration, collaboration, choreography, and public processes. It includes examples and definitions of each concept. Pools represent participants, lanes partition pools, orchestration shows a single participant's internal process, collaboration shows interactions between multiple participants, choreography shows the sequence of interactions, and public processes show only interactions between private processes.
This document provides an overview of a training course on basic SQL queries. The course objectives are to learn how to execute basic SELECT statements, restrict and sort query results, and use aggregation functions. The topics covered include the SELECT statement, comparison operators, logical operators, the ORDER BY clause, and substitution variables. The document provides examples of SQL syntax for each topic and explains how to use the iSQL*Plus tool to interact with database tables and run queries.
The document discusses SAS training which includes:
1) Reading data from raw data files, formatting the data, and performing statistical analysis and data manipulation.
2) Combining and subsetting different data sets.
3) Processing data iteratively through loops and producing final reports.
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.
DDL(Data defination Language ) Using OracleFarhan Aslam
The document discusses DDL and DCL commands in Oracle including naming rules for objects, data types, creating tables, constraints, defining constraints, updating and violating constraints, creating tables using subqueries, altering tables, views, sequences, granting and revoking privileges, and dropping tables. It also discusses the Oracle data dictionary.
The document provides an overview of key database concepts including:
- A database is a collection of logically related information stored and managed using database management system software.
- Relational databases organize data into tables with rows and columns and use keys to link related data across tables. Structured Query Language (SQL) is used to perform operations like data queries and manipulation.
- Database management involves tasks like defining the database structure with data definition language statements, manipulating data with data manipulation language statements, and running queries with the SELECT statement to retrieve and work with data in the database.
A talk given by Julian Hyde at DataCouncil SF on April 18, 2019
How do you organize your data so that your users get the right answers at the right time? That question is a pretty good definition of data engineering — but it is also describes the purpose of every DBMS (database management system). And it’s not a coincidence that these are so similar.
This talk looks at the patterns that reoccur throughout data management — such as caching, partitioning, sorting, and derived data sets. As the speaker is the author of Apache Calcite, we first look at these patterns through the lens of Relational Algebra and DBMS architecture. But then we apply these patterns to the modern data pipeline, ETL and analytics. As a case study, we look at how Looker’s “derived tables” blur the line between ETL and caching, and leverage the power of cloud databases.
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 describes the syntax for creating, altering, and dropping tables in SQL. It provides examples of creating tables with column constraints, default values, primary keys, foreign keys, and unique constraints. It also shows how to add, modify, and drop columns from existing tables using ALTER TABLE statements. The final sections cover DML statements for inserting, updating, deleting, and selecting data from tables.
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxchristinemaritza
Charles WilliamsCS362Unit 3 Discussion Board
Structured Query Language for Data Management 1
Structured Query Language for Data Management 36-04-17
Table of Contents
Phase 1- Database Design and DDL 3
Business Rules & Entity Tables 3
Entity Tables: 4
SQL CODE: 4
Screenshots: 8
Phase 2 – Security and DML 13
Task 1 14
Task 2 15
Task 3 16
Task 4 17
Task 5 18
Phase 3 - DML (Select) and Procedures 19
Task 1 19
Task 2 20
Task 3 21
Task 4 22
Task 5 23
Phase 4 – Architecture, Indexes 27
Step 1: CREATE TABLE [Degrees] 27
Step 2: Re-create ‘Classes’ TABLE to add ‘DegreeID’ column and INSERT 6 classes 29
Step 3: ALTER TABLE [Students] 31
Step 5: DML script to INSERT INTO the ‘Students’ table ‘DegreeID’ data 33
Step 6: Display ERD 36
Phase 5 – Views, Transactions, Testing and Performance 37
References 38
Phase 1- Database Design and DDL
I contracted to design and develop a database for CTU that will store individual and confidential university data. This database is required to give the back-end engineering to a front-end web application with an instinctive User/Interface (U/I) to be utilized by the college HR office. We've chosen to utilize Microsoft SQL Server 2012 given the way of information to be put away because it will be more secure, and it additionally gives a suite of server upkeep apparatuses to be deserted with the IT Department once the database and web application have been tried and acknowledged by college partners.
Amid our preparatory gatherings, CTU's necessities were characterized and enough perused to start making of the database. The accompanying areas contain the business tenets and element tables created amid the preparatory gatherings, and additionally duplicates of all the SQL code used to manufacture the database and make the Entity Relationship Diagram (ERD).
Business Rules & Entity Tables
Business Rules:
· A student has a name, a birth date, and gender.
· You must track the date the student started at the university and his or her current GPA, as well as be able to inactivate him or her without deleting information.
· For advising purposes, store the student's background/bio information. This is like a little story.
· An advisor has a name and an e-mail address.
· Students are assigned to one advisor, but one advisor may service multiple students.
· A class has a class code, name, and description.
· You need to indicate the specific classes a student is taking/has taken at the university. Track the date the student started a specific class and the grade earned in that class.
· Each class that a student takes has 4 assignments. Each assignment is worth 100 points.Entity Tables:
SQL CODE:
Create Database:
CREATE DATABASE [Cameron_CTU]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Cameron_CTU', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Cameron_CTU_log', FILENAME = N'c:\Progra ...
Structured Query Language for Data Management 2 Sructu.docxjohniemcm5zt
Structured Query Language for Data Management 2
Sructured Query Language for Data Management 6
Table of Contents
Phase 1- Database Design and DDL 3
Business Rules & Entity Tables 3
Entity Tables: 4
SQL CODE: 4
Screenshots: 8
Phase 2 – Security and DML 13
Task 1 14
Task 2 15
Task 3 16
Task 4 17
Task 5 18
Phase 3 - DML (Select) and Procedures 19
Task 1 19
Task 2 20
Task 3 21
Task 4 22
Task 5 23
Phase 4 – Architecture, Indexes 27
Step 1: CREATE TABLE [Degrees] 27
Step 2: Re-create ‘Classes’ TABLE to add ‘DegreeID’ column and INSERT 6 classes 29
Step 3: ALTER TABLE [Students] 31
Step 5: DML script to INSERT INTO the ‘Students’ table ‘DegreeID’ data 33
Step 6: Display ERD 36
Phase 5 – Views, Transactions, Testing and Performance 37
References 38
Phase 1- Database Design and DDL
My team was recently contracted to design and develop a database for CTU that will store personal and confidential university data. This database is expected to provide the back-end architecture for a front-end web application with an intuitive User/Interface (U/I) to be used by the university HR department. We’ve decided to use Microsoft SQL Server 2012 given the nature of data to be stored because it will be more secure, and it also provides a suite of server maintenance tools to be left behind with the IT Department once the database and web application have been tested and accepted by university stakeholders.
During our preliminary meetings, CTU’s requirements were defined and adequately scoped to begin creation of the database. The following sections contain the business rules and entity tables developed during the preliminary meetings, as well as copies of all the SQL code used to build the database and create the Entity Relationship Diagram (ERD). Business Rules & Entity Tables
Business Rules:
· A student has a name, a birth date, and gender.
· You must track the date the student started at the university and his or her current GPA, as well as be able to inactivate him or her without deleting information.
· For advising purposes, store the student's background/bio information. This is like a little story.
· An advisor has a name and an e-mail address.
· Students are assigned to one advisor, but one advisor may service multiple students.
· A class has a class code, name, and description.
· You need to indicate the specific classes a student is taking/has taken at the university. Track the date the student started a specific class and the grade earned in that class.
· Each class that a student takes has 4 assignments. Each assignment is worth 100 points.Entity Tables:
SQL CODE:
Create Database:
CREATE DATABASE [Cameron_CTU]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Cameron_CTU', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Cameron_CTU_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL11.SCAMERON_CTU\MSSQL\DATA\Cameron_CTU_.
Pandas is a popular Python library for data analysis and manipulation. It allows users to import data from various sources like CSV, Excel, JSON, databases into DataFrames. DataFrames can then be queried, filtered, reshaped, inspected, and exported back into different formats. Some key operations include importing/exporting data, subsetting rows and columns, reshaping the layout, and aggregating/summarizing the data.
This document discusses various data definition language (DDL) statements in SQL. It describes DDL statements to create, modify, and delete database objects like schemas, tables, views, and indexes. Specifically, it covers the CREATE, ALTER, and DROP statements for schemas, tables, views, indexes, and constraints. Examples are provided for each statement type.
The document provides an overview of SQL (Structured Query Language), including its standards, environment, data types, DDL (Data Definition Language) for defining database schema, DML (Data Manipulation Language) for manipulating data, and DCL (Data Control Language) for controlling access. It discusses SQL statements for defining tables, inserting, updating, deleting, and querying data using SELECT statements with various clauses. Views are also introduced as virtual tables defined by a SELECT statement on base tables.
Getting started with Pandas Cheatsheet.pdfSudhakarVenkey
Pandas is a popular Python library for data wrangling and analysis that can handle various data formats like CSV, Excel, JSON, HTML, and SQL. It allows users to create DataFrames from dictionaries, lists, and by importing data from text, Excel files, websites, databases and JSON. DataFrames can be exported, inspected by viewing rows and columns, subsetted by selecting rows and columns, queried using logical conditions, and reshaped by changing layout, renaming columns, appending rows/columns, and sorting values.
Structured Query Language (SQL) is used to define, manipulate, and control data in a relational database. The document provides an overview of SQL, covering its main components like Data Definition Language (DDL) for defining tables, Data Manipulation Language (DML) for inserting, updating, deleting and selecting data, and Data Control Language (DCL) for controlling database privileges. It describes the basic DML commands, discusses integrity constraints and transactions, and shows how to perform single table and joined queries using SQL syntax.
The document provides an overview of SQL (Structured Query Language) including its purpose, benefits, and key components. It describes the SQL environment and data types, as well as the main SQL statements used for database definition (DDL), data manipulation (DML), and control (DCL). Examples are given for common statements like CREATE TABLE, SELECT, INSERT, UPDATE, DELETE, and how to define views, integrity controls, indexes and more.
This document provides an overview of relational databases and the Microsoft SQL Server database management system. It defines key concepts like tables, primary keys, and foreign keys. It also describes popular DBMSs, database structures in SQL Server like client/server and n-tier architectures, and how to create indexes, backups, restores, stored procedures, triggers, views, and functions. The document includes syntax examples and concludes with a reference section and questions.
The document discusses setting up MySQL, creating databases and tables, loading data from an SQL file, inserting records, and setting the MySQL JDBC driver to connect to the database from Java programs. Key steps include downloading and installing MySQL, creating a database called javabook and tables called Course, Student, and Enrollment, loading an SQL file to create the tables, inserting sample records, and setting the MySQL JDBC driver classpath to connect from Java.
Integration is the process of combining separate software components into a single system. There are two main approaches: phased integration, where all components are combined at once, and incremental integration, where components are added one at a time. Incremental integration makes it easier to locate bugs and improves progress monitoring. Specific incremental strategies include top-down, bottom-up, and feature-oriented integration. It is generally best to use a combination of approaches for a given project. Daily builds and smoke tests also help reduce integration issues.
The document provides information on various BPMN modeling concepts including pools, lanes, orchestration, collaboration, choreography, and public processes. It includes examples and definitions of each concept. Pools represent participants, lanes partition pools, orchestration shows a single participant's internal process, collaboration shows interactions between multiple participants, choreography shows the sequence of interactions, and public processes show only interactions between private processes.
The document discusses IPv4 addressing and networking concepts. It defines an IPv4 address as a 32-bit address that uniquely identifies devices on the Internet. IPv4 addresses have either a binary or dotted decimal notation. The document also covers IPv4 classes, subnetting, supernetting, and classless addressing which allow for flexible allocation of address blocks.
This chapter discusses advanced entity-relationship modeling concepts including supertype/subtype relationships, generalization and specialization, constraints on supertype/subtype relationships, and business rules. It defines key terms like supertype, subtype, attribute inheritance, and provides examples of using supertype/subtype relationships to model common business situations. The chapter also covers using constraints to specify whether a supertype must have a subtype and whether subtypes are disjoint or can overlap. It introduces using entity clusters to improve readability of large EER diagrams and categorizes different types of business rules.
Access Methods and File System Mounting.pptxlaiba29012
There are three main ways to access files in a computer: sequential access, direct access, and index access. Sequential access reads files in order from beginning to end, direct access allows reading or writing any block directly by number, and index access uses pointers in an index to access records. A file system must be mounted before files can be accessed, with mount points typically being empty directories where the file system attaches within the overall file structure.
This document discusses memory management techniques in operating systems. It covers topics like swapping, contiguous memory allocation, paging, segmentation, and page tables. Paging divides memory into fixed-size blocks called frames and logical memory into blocks called pages. It uses a page table to map logical page numbers to physical frame numbers. Hierarchical and hashed page tables are discussed as structures to organize large page tables. Segmentation and paging can both be used to map logical to physical addresses.
This document presents a business plan for a company called Global Landfill Gas Production that aims to produce biogas from garbage using a waste-to-energy converter bin. The bin uses bacteria to break down organic waste and produce methane gas, which will then be transferred to containers and used as fuel by industries. The initial financing required is 2.9 million rupees to cover setup costs. The plan describes the production process, market potential in Pakistan, and competition in the waste management industry. It concludes there is considerable room for growth but also challenges from other firms developing new waste management technologies.
A distributed database (DDB) is a collection of logically related databases distributed across a computer network. It allows data and processing to occur at multiple sites. Key characteristics include data fragmentation across sites, replication of fragments for availability and performance, and distributed transaction management to ensure consistency. The main types are homogeneous DDBMS, where all sites use identical software, and heterogeneous DDBMS where different sites may use different systems. Challenges include complex management, security, and maintaining consistency across sites.
This document outlines a business idea for improving gym services. It identifies problems with the current manual system such as misinformation and elitist attitudes. The proposed solution is to digitalize services, offer video tutorials and seminars, implement friend/partner pricing and a reward program. This aims to educate staff, treat members as individuals, and build a supportive community.
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on automated letter generation for Bonterra Impact Management using Google Workspace or Microsoft 365.
Interested in deploying letter generation automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
A Comprehensive Guide to DeFi Development Services in 2024Intelisync
DeFi represents a paradigm shift in the financial industry. Instead of relying on traditional, centralized institutions like banks, DeFi leverages blockchain technology to create a decentralized network of financial services. This means that financial transactions can occur directly between parties, without intermediaries, using smart contracts on platforms like Ethereum.
In 2024, we are witnessing an explosion of new DeFi projects and protocols, each pushing the boundaries of what’s possible in finance.
In summary, DeFi in 2024 is not just a trend; it’s a revolution that democratizes finance, enhances security and transparency, and fosters continuous innovation. As we proceed through this presentation, we'll explore the various components and services of DeFi in detail, shedding light on how they are transforming the financial landscape.
At Intelisync, we specialize in providing comprehensive DeFi development services tailored to meet the unique needs of our clients. From smart contract development to dApp creation and security audits, we ensure that your DeFi project is built with innovation, security, and scalability in mind. Trust Intelisync to guide you through the intricate landscape of decentralized finance and unlock the full potential of blockchain technology.
Ready to take your DeFi project to the next level? Partner with Intelisync for expert DeFi development services today!
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
Trusted Execution Environment for Decentralized Process MiningLucaBarbaro3
Presentation of the paper "Trusted Execution Environment for Decentralized Process Mining" given during the CAiSE 2024 Conference in Cyprus on June 7, 2024.
Digital Marketing Trends in 2024 | Guide for Staying AheadWask
https://www.wask.co/ebooks/digital-marketing-trends-in-2024
Feeling lost in the digital marketing whirlwind of 2024? Technology is changing, consumer habits are evolving, and staying ahead of the curve feels like a never-ending pursuit. This e-book is your compass. Dive into actionable insights to handle the complexities of modern marketing. From hyper-personalization to the power of user-generated content, learn how to build long-term relationships with your audience and unlock the secrets to success in the ever-shifting digital landscape.
Dive into the realm of operating systems (OS) with Pravash Chandra Das, a seasoned Digital Forensic Analyst, as your guide. 🚀 This comprehensive presentation illuminates the core concepts, types, and evolution of OS, essential for understanding modern computing landscapes.
Beginning with the foundational definition, Das clarifies the pivotal role of OS as system software orchestrating hardware resources, software applications, and user interactions. Through succinct descriptions, he delineates the diverse types of OS, from single-user, single-task environments like early MS-DOS iterations, to multi-user, multi-tasking systems exemplified by modern Linux distributions.
Crucial components like the kernel and shell are dissected, highlighting their indispensable functions in resource management and user interface interaction. Das elucidates how the kernel acts as the central nervous system, orchestrating process scheduling, memory allocation, and device management. Meanwhile, the shell serves as the gateway for user commands, bridging the gap between human input and machine execution. 💻
The narrative then shifts to a captivating exploration of prominent desktop OSs, Windows, macOS, and Linux. Windows, with its globally ubiquitous presence and user-friendly interface, emerges as a cornerstone in personal computing history. macOS, lauded for its sleek design and seamless integration with Apple's ecosystem, stands as a beacon of stability and creativity. Linux, an open-source marvel, offers unparalleled flexibility and security, revolutionizing the computing landscape. 🖥️
Moving to the realm of mobile devices, Das unravels the dominance of Android and iOS. Android's open-source ethos fosters a vibrant ecosystem of customization and innovation, while iOS boasts a seamless user experience and robust security infrastructure. Meanwhile, discontinued platforms like Symbian and Palm OS evoke nostalgia for their pioneering roles in the smartphone revolution.
The journey concludes with a reflection on the ever-evolving landscape of OS, underscored by the emergence of real-time operating systems (RTOS) and the persistent quest for innovation and efficiency. As technology continues to shape our world, understanding the foundations and evolution of operating systems remains paramount. Join Pravash Chandra Das on this illuminating journey through the heart of computing. 🌟
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxSitimaJohn
Ocean Lotus cyber threat actors represent a sophisticated, persistent, and politically motivated group that poses a significant risk to organizations and individuals in the Southeast Asian region. Their continuous evolution and adaptability underscore the need for robust cybersecurity measures and international cooperation to identify and mitigate the threats posed by such advanced persistent threat groups.
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Database queries
1. Chapter 6:
Introduction to SQL
Modern Database Management
10th Edition
Jeffrey A. Hoffer, Mary B. Prescott,
Fred R. McFadden
2. Introduction
Also pronounced as “Sequel”
A de-facto standard for relational DBMS
Standard accepted by bodies like ANSI
and ISO
3. Introduction
First commercial DBMS that support SQL
in 1979 was Oracle
Another form of query language is
Query-by-Example (QBE) supported by
PC-based DBMSs
4. History
Relational data model introduced
by Codd in 1970
A relational DBMS project started
by IBM was system R that
included sequel as manipulation
language
5. History
First commercial DBMS launched
was Oracle in 1979
Other early DBMSs DB2, INGRES
ANSI and ISO defined first standard
of SQL in 1986 known as SQL-86
that was further extended to SQL-
89
6. History
Later two more standards known as
SQL-92 and SQL-99 were defined
Almost all of the current DBMSs
support SQL-92 and many support
SQL-99 partially or completely
SQL today is supported in all sort of
machines
7. Benefits of Standard SQL
Reduced training cost
Application portability
Application longevity
Reduced dependence on a single
vendor
Cross-system communication
8. SQL
SQL is used for any type of interaction
with the database through DBMS
Right from creating database, tables,
views, users
Insertion, updation, deletion of data in
the database
9. SQL and DBMSs
Implementation of SQL always includes
the flavor of the particular DBMS, like in
names of data types
Proprietary SQLs exist, like T-SQL and
PL-SQL
10. MS SQL Server
The DBMS for our course is
Microsoft’s SQL Server 2000
desktop edition
Two main tools Query Analyzer
and Enterprise Manager; both can
be used
For SQL practice we will use QA
11. Terminology of SS
Instance of SQL Server
Instance contains different objects
like databases, security, DTS etc.
Then databases object of SS contains
multiple databases, each database
contains multiple objects like tables,
views, users, roles etc.
12. Working in SS
After installing SS, we will create
database using create command
After this we will create tables and
other objects within this database
14. Create Command
Creating database
CREATE DATABASE db_name
Create database exam
Next step is to create tables
Two approaches:
Through SQL Create command
Through Enterprise Manager
15. Create Table Command
Create table command is used to:
Create a table
Define attributes of the table with data types
Define different constraints on attributes, like
primary and foreign keys, check constraint,
not null, default value etc.
24. CREATE TABLE semester (
semName char(5) primary key,
stDate smalldatetime,
endDate smalldatetime,
constraint ck_date_val check
(datediff(days, stDate, endDate) between
100 and 120))
Create Table with Constraint
25. Alter Table Statement
Purpose is to make changes in
the definition of a table already
created through Create statement
Can add, drop attributes or
constraints, activate or deactivate
constraints; the format is
27. ALTER TABLE Student
add constraint fk_st_pr
foreign key (prName) references
Program (prName)
ALTER TABLE program
add constraint ck_totSem
check (totSem < 9)
Alter Table Command
28. Removing or Changing Attribute
ALTER TABLE student
ALTER COLUMN stFName char(20)
Alter table student
drop column curSem
Alter table student
drop constraint ck_st_pr
29. Removing Tables
TRUNCATE TABLE table_name
Truncate table class
Delete can also be used
DROP TABLE table_name
32. Insert
COURSE (crCode, crName, crCredits,
prName)
INSERT INTO course VALUES (‘CS-211',
‘Operating Systems’, 4, ‘MCS’)
INSERT INTO course (crCode, crName)
VALUES (‘CS-316’, Database Systems’)
INSERT INTO course (‘MG-103’, ‘Intro to
Management’, NULL, NULL)
33. stId stName prName cgpa
S1020 Sohail Dar MCS 2.8
S1038 Shoaib Ali BCS 2.78
S1015 Tahira Ejaz MCS 3.2
S1034 Sadia Zia BIT
S1018 Arif Zia BIT 3.0
STUDENT
prName totSem prCrdts
BCS 8 134
BIT 8 132
MBA 4 65
MCS 4 64
PROGRAM
crCode crTitle crCrdts prName
CS-616 Intro to Database Systems 4 MCS
MG-314 Money & Capital Market 3 BIT
CS-516 Data Structures and Algos 4 MCS
MG-105 Introduction to Accounting 3 MBA
stId crCode semName mTerm sMrks fMrks totMrks grade gPoint
S1020 CS-616 F04 25 12.5 35 72.5 B- 2.7
S1018 MG-314 F04 26.5 10.5 39 76 B 3.1
S1015 CS-616 F04 30 10 40 80 B+ 3.5
S1015 CS-516 F04 32 12 42 86 A- 4.1
COURSE
ENROLL
34. Select Statement
Maximum used command in DML
Used not only to select certain rows but also
the columns
Also used for different forms of product, that
is, different joins
38. Select
Q: Give the names of the students
with the program name
SELECT stName, prName
FROM student
39.
40. Attribute Alias
Another Name “Urf” for an attribute
SELECT {*|col_name [[AS] alias] [, …n]}
FROM tab_name
SELECT stName as ‘Student Name’ , prName
‘Program’ FROM Student
41.
42. Expression in Select
In the column list we can also give the
expression; value of the expression is
computed and displayed
43. Expression Example
Q: Display the total sessional marks of each
student obtained in each subject
Select stId, crCode, mTerm + sMrks
‘Total out of 50’ from enroll
44.
45. Expression Example
Q: List the names of the students and the
program they are enrolled in, in the format
“std studies in prg”
SELECT stName + ‘ studies in ‘ + prName
FROM student
46.
47. Select Distinct
The DISTINCT keyword is used to return
only distinct (different) values
48. Just add a DISTINCT keyword to
the SELECT statement
SELECT DISTINCT
column_name(s) FROM
table_name
Select Distinct
49. Q: Get the program names in which
students are enrolled
SELECT prName FROM Student
Select Distinct
50.
51. Q: Get the program names in which
students are enrolled
SELECT prName FROM Student
SELECT DISTINCT prName FROM
Student
Select Distinct
52.
53. Placing the Checks on
Rows
Limit rows or to select certain rows, like,
Programs of certain length, credits;
students with particular names, programs,
age, places etc.
54. The WHERE Clause
We used names to limit columns, but rows
cannot be named due to the dynamicity
We limit the rows using conditions
55. The WHERE Clause
Conditions are defined on the values of
one or more attributes from one or more
tables and placed in the WHERE clause
56. Where: Format
SELECT [ALL|DISTINCT]
{*|culumn_list [alias][,…..n]} FROM
table_name
[WHERE <search_condition>]
58. Where Example
Q: Display all courses of the MCS program
Select crCode, crName, prName from
course
where prName = ‘MCS’
59.
60.
61. Not Operator
Inverses the predicate’s value
Q: List the course names offered to
programs other than MCS
SELECT crCode, crName, prName
FROM course
WHERE not (prName = ‘MCS’)
64. The BETWEEN Operator
Checks the value in a range
Q: List the IDs of the students with course
codes having marks between 70 and 80
SELECT stId, crCode, totMrks
From ENROLL
WHERE totMrks between 70 and 80
65.
66. The IN Operator
Checks in a list of values
Q: Give the course names of MCS and BCS
programs
SELECT crName, prName
From course
Where prName in (‘MCS’, ‘BCS’)
69. Like Operator
Q: Display the names and credits of CS
programs
SELECT crName, crCrdts, prName FROM
course
WHERE prName like '%CS'
70.
71. “Order By” Clause
Sorts the rows in a particular order
SELECT select_list
FROM table_source
[ WHERE search_condition ]
[ ORDER BY order_expression [ ASC | DESC ]
[,……n]
]
72. Order By Example
Q: Display the students’ data in the
ascending order of names
SELECT * from STUDENT
ORDER BY stName
73.
74. Practice Query
Display the name and cgpa of students for
all those students who are in second or
above semester in descending order of
names
75. Functions in SQL
Built-in functions are pre-written programs
to perform specific tasks
Accept certain arguments and return the
result
76. Categories of Functions
Depending on the arguments and the return
value, categorized
Mathematical (ABS, ROUND, SIN, SQRT)
String (LOWER, UPPER, SUBSTRING, LEN)
Date (DATEDIFF, DATEPART, GETDATE())
System (USER, DATALENGTH, HOST_NAME)
Conversion (CAST, CONVERT)
79. Aggregate Functions
Operate on a set of rows and return a
single value, like, AVG, SUM, MAX, MIN,
STDEV
Attribute list cannot contain other
attributes if an aggregate function is being
used
80. Aggregate Function Example
SELECT avg(cgpa) as 'Average CGPA',
max(cgpa) as 'Maximum CGPA' from student
Output is……
81.
82. Aggregate Function Example
SELECT avg(cgpa) as 'Average
CGPA', max(cgpa) as 'Maximum
CGPA' from student
SELECT convert( decimal(5,2),
avg(cgpa)) as 'Average CGPA',
max(cgpa) as 'Maximum CGPA' from
student
83.
84. Group By Clause
SELECT stName, avg(cgpa) as
'Average CGPA', max(cgpa) as
'Maximum CGPA' from student
SELECT prName, max(cgpa) as ‘Max
CGPA', min(cgpa) as ‘Min CGPA'
FROM student GROUP BY prName
85.
86. HAVING Clause
We can restrict groups by using having
clause; groups satisfying having condition
will be selected
87. HAVING Clause
SELECT select_list
[ INTO new_table ]
FROM table_source
[ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
[ ORDER BY order_expression [ ASC |
DESC ] ]
94. Cartesian Product
Certain columns can be selected, same
column name needs to be qualified
Similarly can be applied to more than one
tables, and even can be applied on the
same table
SELECT * from Student, class, program