This document discusses different types of constraints in SQL including primary keys, foreign keys, unique constraints, and check constraints. It provides the syntax for creating each constraint using CREATE TABLE and ALTER TABLE statements. Primary keys enforce uniqueness and can be defined to include one or multiple columns. Foreign keys enforce referential integrity by linking columns in one table to columns in another table. Unique constraints require that the values in a column or set of columns are unique. Check constraints specify conditions that each row must satisfy.
This presentation is on SQL constraints. This presentation was used by me in my YouTube vlog on SQL constraints. Vlog link: https://youtu.be/E94YFmATqb4
This document discusses different types of constraints in a database including:
- Field constraints like NOT NULL, check, unique, primary key, foreign key
- Table constraints like check, unique, primary key, foreign key
- Examples of different constraints like required fields, check constraints using operators, ranges, lists, pattern matching, default values, unique, primary key, foreign key, and identity columns. It also discusses how to add, change, and drop constraints using ALTER and CREATE statements.
MySql Triggers Tutorial - The Webs Academythewebsacademy
A SQL trigger is a set of SQL statements stored in the database catalog. A SQL trigger is executed or fired whenever an event associated with a table occurs e.g., insert, update or delete.
This document provides an overview of how to create and manage various schema objects in Oracle, including views, sequences, indexes, and synonyms. It discusses how to create simple and complex views, retrieve data from views, and perform DML operations on views. It also covers how to create, use, modify and cache sequences, and how to create nonunique indexes to improve query performance. Finally, it discusses how to create synonyms to provide alternative names for objects.
This document introduces SQL group functions. It discusses how to use aggregate functions like SUM, AVG, COUNT, MIN, MAX to perform calculations across multiple rows. It explains how to use the GROUP BY clause to group data and the HAVING clause as the WHERE clause for grouped data. It also covers nesting functions, order of clause evaluation, and statistical functions like STDDEV and VARIANCE.
The document discusses different types of SQL joins, including inner joins, outer joins, equi joins, non-equi joins, natural joins, cross joins, left joins, right joins, full outer joins, and self joins. It provides the syntax and examples for each type of join. It also discusses joining tables through referential integrity, where a foreign key references a primary key in another table to link the tables together.
Triggers are stored procedures that are automatically executed in response to certain events occurring on a particular table or view in a database, such as insert, update or delete statements. Triggers consist of an event, condition, and action. The event specifies when the trigger should fire, the condition is an optional filter to determine whether the trigger action should execute, and the action contains SQL statements or code that will execute in response to the triggering event if the condition evaluates to true. Triggers allow data integrity checks, auditing, and other actions to be performed automatically in response to data changes.
Presentation slides of Sequence Query Language (SQL)Punjab University
SQL is a language used to communicate with and perform operations on relational database management systems (RDBMS). The document outlines what SQL is, what it can do, important SQL commands like SELECT, INSERT, UPDATE and DELETE, how to create and drop databases and tables, and key concepts like primary keys, foreign keys, and constraints. SQL allows users to retrieve, manipulate and transform data stored in an RDBMS through statements that include keywords, clauses, aggregates, expressions, identifiers, parameters, and operators.
This presentation is on SQL constraints. This presentation was used by me in my YouTube vlog on SQL constraints. Vlog link: https://youtu.be/E94YFmATqb4
This document discusses different types of constraints in a database including:
- Field constraints like NOT NULL, check, unique, primary key, foreign key
- Table constraints like check, unique, primary key, foreign key
- Examples of different constraints like required fields, check constraints using operators, ranges, lists, pattern matching, default values, unique, primary key, foreign key, and identity columns. It also discusses how to add, change, and drop constraints using ALTER and CREATE statements.
MySql Triggers Tutorial - The Webs Academythewebsacademy
A SQL trigger is a set of SQL statements stored in the database catalog. A SQL trigger is executed or fired whenever an event associated with a table occurs e.g., insert, update or delete.
This document provides an overview of how to create and manage various schema objects in Oracle, including views, sequences, indexes, and synonyms. It discusses how to create simple and complex views, retrieve data from views, and perform DML operations on views. It also covers how to create, use, modify and cache sequences, and how to create nonunique indexes to improve query performance. Finally, it discusses how to create synonyms to provide alternative names for objects.
This document introduces SQL group functions. It discusses how to use aggregate functions like SUM, AVG, COUNT, MIN, MAX to perform calculations across multiple rows. It explains how to use the GROUP BY clause to group data and the HAVING clause as the WHERE clause for grouped data. It also covers nesting functions, order of clause evaluation, and statistical functions like STDDEV and VARIANCE.
The document discusses different types of SQL joins, including inner joins, outer joins, equi joins, non-equi joins, natural joins, cross joins, left joins, right joins, full outer joins, and self joins. It provides the syntax and examples for each type of join. It also discusses joining tables through referential integrity, where a foreign key references a primary key in another table to link the tables together.
Triggers are stored procedures that are automatically executed in response to certain events occurring on a particular table or view in a database, such as insert, update or delete statements. Triggers consist of an event, condition, and action. The event specifies when the trigger should fire, the condition is an optional filter to determine whether the trigger action should execute, and the action contains SQL statements or code that will execute in response to the triggering event if the condition evaluates to true. Triggers allow data integrity checks, auditing, and other actions to be performed automatically in response to data changes.
Presentation slides of Sequence Query Language (SQL)Punjab University
SQL is a language used to communicate with and perform operations on relational database management systems (RDBMS). The document outlines what SQL is, what it can do, important SQL commands like SELECT, INSERT, UPDATE and DELETE, how to create and drop databases and tables, and key concepts like primary keys, foreign keys, and constraints. SQL allows users to retrieve, manipulate and transform data stored in an RDBMS through statements that include keywords, clauses, aggregates, expressions, identifiers, parameters, and operators.
This document provides an overview of SQL programming including:
- A brief history of SQL and how it has evolved over time.
- Key SQL fundamentals like database structures, tables, relationships, and normalization.
- How to define and modify database structures using commands like CREATE, ALTER, DROP.
- How to manipulate data using INSERT, UPDATE, DELETE, and transactions.
- How to retrieve data using SELECT statements, joins, and other techniques.
- How to aggregate data using functions like SUM, AVG, MAX, MIN, and COUNT.
- Additional topics covered include subqueries, views, and resources for further learning.
Data Definition Language (DDL), Data Definition Language (DDL), Data Manipulation Language (DML) , Transaction Control Language (TCL) , Data Control Language (DCL) - , SQL Constraints
Clauses in Sql(Structured Query Language), distinct clause, where clause, where clause, order by clause, group by clause, having clause, Relational Database Management System
This document provides an overview of database concepts including creating, altering, and dropping databases and tables. It discusses data definition language (DDL) commands like CREATE, ALTER, DROP as well as data manipulation language (DML) commands like INSERT, SELECT, UPDATE, DELETE. It also covers database constraints, joins, functions for aggregation, strings, numbers, dates and more. The document is an introduction to core SQL concepts for a course on data management and database design.
(** MYSQL DBA Certification Training https://www.edureka.co/mysql-dba **)
This Edureka PPT on SQL Joins will discuss the various types of Joins used in SQL Server with examples. The following topics will be covered in this PPT:
Introduction to SQL
What are Joins?
Types of Joins
FAQs about Joins
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
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
SQL is a language for managing and manipulating databases. It includes languages for data definition (DDL), data manipulation (DML), data retrieval (DRL), transaction control (TCL), and data control (DCL). The document provides detailed syntax examples for creating tables, inserting data, selecting data using conditions, updating and deleting records, and managing transactions using commands like commit, rollback, and savepoints. It also covers altering tables and dropping or renaming database objects.
What is PL/SQL
Procedural Language – SQL
An extension to SQL with design features of programming languages (procedural and object oriented)
PL/SQL and Java are both supported as internal host languages within Oracle products.
This document discusses indexing in MySQL databases to improve query performance. It begins by defining an index as a data structure that speeds up data retrieval from databases. It then covers various types of indexes like primary keys, unique indexes, and different indexing algorithms like B-Tree, hash, and full text. The document discusses when to create indexes, such as on columns frequently used in queries like WHERE clauses. It also covers multi-column indexes, partial indexes, and indexes to support sorting, joining tables, and avoiding full table scans. The concepts of cardinality and selectivity are introduced. The document concludes with a discussion of index overhead and using EXPLAIN to view query execution plans and index usage.
This document discusses binary search trees (BSTs). It defines BSTs as binary trees where all left descendants of a node are less than the node's value and all right descendants are greater. It describes how to implement a BST using linked nodes, and how to perform operations like insertion, searching, and different traversal orders through the tree. The document is presented by Mahmoud Rafeek Al-farra and contains details on representing, inserting into, searching, and traversing BSTs implemented as a concrete Java class.
The document provides an overview of database concepts and features in Oracle, including fundamentals like data grouping and relationships, as well as operations on tables like insert, update, delete. It also covers queries with filters, joins, and aggregations, as well as other objects like views, sequences, indexes, triggers, and stored procedures. The document is intended as training material for the Oracle database.
"Dear Students,
Greetings from www.etraining.guru
We provide BEST online training for IBM DB2 LUW/UDB DBA by a database architect. Our DB2 Trainer comes with a working experience of 11+ years, 9+ years in DB2 and a DB2 certified professional.
DB2 LUW DBA Course Content: http://www.etraining.guru/course/dba/online-training-db2-luw-udb-dba
Course Cost: USD 350 (or) INR 21000
Number of Hours: 30-35 hours
Regards,
Karthik
www.etraining.guru"
This document provides an introduction to SQL server functions, grouping, and joins. It discusses aggregate functions that return single values from columns like average, sum, min, and count. It also discusses scalar functions that return a single value for each row like upper, lower, and round. The document explains how to use the GROUP BY clause to group result sets and then run aggregate functions on the groups. It also covers the HAVING clause, which filters grouped data. Finally, it describes different types of joins like inner joins, left outer joins, and right outer joins.
MySQL JOINS allow retrieving data from two or more related database tables using primary and foreign keys. There are several types of JOINs: Cross JOINs return all combinations of rows from both tables; Inner JOINs return rows where the joined columns are equal; Left and Right JOINs return all rows from the left or right table respectively and matching rows from the other table. JOINs improve performance over multiple queries by using indexing and reducing data transfers between MySQL and applications.
SQL is a standard language for storing, manipulating and retrieving data in databases. It allows users to access and manipulate data in databases. Some key functions of SQL include executing queries against a database, retrieving data from a database, inserting, updating and deleting records in a database, and creating, altering and dropping database objects like tables.
SQL is a standard language for querying and manipulating data in relational databases. It contains five categories of statements: data definition language (DDL) for defining data structure, data manipulation language (DML) for managing data, data control language (DCL) for privileges, transaction control statements for transactions, and session control statements for sessions. Common DDL commands include CREATE, ALTER, and DROP for databases and tables. Common DML commands include SELECT, INSERT, UPDATE, and DELETE for querying and modifying data. Joins are used to combine data from two or more tables.
PL/SQL is a combination of SQL and procedural languages that enhances SQL's capabilities. It allows processing of SQL statements as a block. A PL/SQL block consists of optional declaration, mandatory execution, and optional exception sections. Variables, constants, records can be declared in the declaration section and used in the execution section. The execution section contains the main program logic. Exceptions are handled in the exception section. PL/SQL supports programming constructs like conditional statements and loops.
Nested queries allow users to embed one SQL query within another query. A nested query contains a subquery, which is typically placed in the WHERE clause. Subqueries can also appear in the FROM or HAVING clauses. The GROUP BY clause allows applying aggregate functions like COUNT, SUM, AVG to each group of rows, with the HAVING clause filtering the groups based on conditions.
The document provides an overview of SQL and reasons for learning SQL. It discusses what SQL is, why learn SQL, and provides an overview of SQL functions including retrieving data using SELECT statements, arithmetic expressions, null values, column aliases, concatenation operators, literal character strings, and alternative quote operators. It also covers restricting and sorting data using WHERE clauses, comparison operators, logical operators, pattern matching, and null conditions.
This document discusses different types of constraints in SQL. It explains that constraints are used to specify rules for data in tables to ensure accuracy and reliability. If a constraint is violated by an action, the action is aborted. There are two types of constraints - column level constraints which apply to a single column, and table level constraints which apply to multiple columns. The document provides examples of different constraint types like primary keys, unique keys, not null constraints, check constraints, and foreign keys. It also discusses concepts like cascading deletes and setting foreign keys to null when the referenced row is deleted.
The document provides an overview of SQL commands and syntax for creating and managing databases, tables, and querying data. Key points covered include:
- SQL commands for defining schema (CREATE TABLE), manipulating data (INSERT, UPDATE, DELETE), and querying data (SELECT).
- Data types, constraints, indexes and joins.
- Examples of SQL syntax for common queries and operations like filtering, sorting, aggregation, and joining tables.
This document provides an overview of SQL programming including:
- A brief history of SQL and how it has evolved over time.
- Key SQL fundamentals like database structures, tables, relationships, and normalization.
- How to define and modify database structures using commands like CREATE, ALTER, DROP.
- How to manipulate data using INSERT, UPDATE, DELETE, and transactions.
- How to retrieve data using SELECT statements, joins, and other techniques.
- How to aggregate data using functions like SUM, AVG, MAX, MIN, and COUNT.
- Additional topics covered include subqueries, views, and resources for further learning.
Data Definition Language (DDL), Data Definition Language (DDL), Data Manipulation Language (DML) , Transaction Control Language (TCL) , Data Control Language (DCL) - , SQL Constraints
Clauses in Sql(Structured Query Language), distinct clause, where clause, where clause, order by clause, group by clause, having clause, Relational Database Management System
This document provides an overview of database concepts including creating, altering, and dropping databases and tables. It discusses data definition language (DDL) commands like CREATE, ALTER, DROP as well as data manipulation language (DML) commands like INSERT, SELECT, UPDATE, DELETE. It also covers database constraints, joins, functions for aggregation, strings, numbers, dates and more. The document is an introduction to core SQL concepts for a course on data management and database design.
(** MYSQL DBA Certification Training https://www.edureka.co/mysql-dba **)
This Edureka PPT on SQL Joins will discuss the various types of Joins used in SQL Server with examples. The following topics will be covered in this PPT:
Introduction to SQL
What are Joins?
Types of Joins
FAQs about Joins
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
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
SQL is a language for managing and manipulating databases. It includes languages for data definition (DDL), data manipulation (DML), data retrieval (DRL), transaction control (TCL), and data control (DCL). The document provides detailed syntax examples for creating tables, inserting data, selecting data using conditions, updating and deleting records, and managing transactions using commands like commit, rollback, and savepoints. It also covers altering tables and dropping or renaming database objects.
What is PL/SQL
Procedural Language – SQL
An extension to SQL with design features of programming languages (procedural and object oriented)
PL/SQL and Java are both supported as internal host languages within Oracle products.
This document discusses indexing in MySQL databases to improve query performance. It begins by defining an index as a data structure that speeds up data retrieval from databases. It then covers various types of indexes like primary keys, unique indexes, and different indexing algorithms like B-Tree, hash, and full text. The document discusses when to create indexes, such as on columns frequently used in queries like WHERE clauses. It also covers multi-column indexes, partial indexes, and indexes to support sorting, joining tables, and avoiding full table scans. The concepts of cardinality and selectivity are introduced. The document concludes with a discussion of index overhead and using EXPLAIN to view query execution plans and index usage.
This document discusses binary search trees (BSTs). It defines BSTs as binary trees where all left descendants of a node are less than the node's value and all right descendants are greater. It describes how to implement a BST using linked nodes, and how to perform operations like insertion, searching, and different traversal orders through the tree. The document is presented by Mahmoud Rafeek Al-farra and contains details on representing, inserting into, searching, and traversing BSTs implemented as a concrete Java class.
The document provides an overview of database concepts and features in Oracle, including fundamentals like data grouping and relationships, as well as operations on tables like insert, update, delete. It also covers queries with filters, joins, and aggregations, as well as other objects like views, sequences, indexes, triggers, and stored procedures. The document is intended as training material for the Oracle database.
"Dear Students,
Greetings from www.etraining.guru
We provide BEST online training for IBM DB2 LUW/UDB DBA by a database architect. Our DB2 Trainer comes with a working experience of 11+ years, 9+ years in DB2 and a DB2 certified professional.
DB2 LUW DBA Course Content: http://www.etraining.guru/course/dba/online-training-db2-luw-udb-dba
Course Cost: USD 350 (or) INR 21000
Number of Hours: 30-35 hours
Regards,
Karthik
www.etraining.guru"
This document provides an introduction to SQL server functions, grouping, and joins. It discusses aggregate functions that return single values from columns like average, sum, min, and count. It also discusses scalar functions that return a single value for each row like upper, lower, and round. The document explains how to use the GROUP BY clause to group result sets and then run aggregate functions on the groups. It also covers the HAVING clause, which filters grouped data. Finally, it describes different types of joins like inner joins, left outer joins, and right outer joins.
MySQL JOINS allow retrieving data from two or more related database tables using primary and foreign keys. There are several types of JOINs: Cross JOINs return all combinations of rows from both tables; Inner JOINs return rows where the joined columns are equal; Left and Right JOINs return all rows from the left or right table respectively and matching rows from the other table. JOINs improve performance over multiple queries by using indexing and reducing data transfers between MySQL and applications.
SQL is a standard language for storing, manipulating and retrieving data in databases. It allows users to access and manipulate data in databases. Some key functions of SQL include executing queries against a database, retrieving data from a database, inserting, updating and deleting records in a database, and creating, altering and dropping database objects like tables.
SQL is a standard language for querying and manipulating data in relational databases. It contains five categories of statements: data definition language (DDL) for defining data structure, data manipulation language (DML) for managing data, data control language (DCL) for privileges, transaction control statements for transactions, and session control statements for sessions. Common DDL commands include CREATE, ALTER, and DROP for databases and tables. Common DML commands include SELECT, INSERT, UPDATE, and DELETE for querying and modifying data. Joins are used to combine data from two or more tables.
PL/SQL is a combination of SQL and procedural languages that enhances SQL's capabilities. It allows processing of SQL statements as a block. A PL/SQL block consists of optional declaration, mandatory execution, and optional exception sections. Variables, constants, records can be declared in the declaration section and used in the execution section. The execution section contains the main program logic. Exceptions are handled in the exception section. PL/SQL supports programming constructs like conditional statements and loops.
Nested queries allow users to embed one SQL query within another query. A nested query contains a subquery, which is typically placed in the WHERE clause. Subqueries can also appear in the FROM or HAVING clauses. The GROUP BY clause allows applying aggregate functions like COUNT, SUM, AVG to each group of rows, with the HAVING clause filtering the groups based on conditions.
The document provides an overview of SQL and reasons for learning SQL. It discusses what SQL is, why learn SQL, and provides an overview of SQL functions including retrieving data using SELECT statements, arithmetic expressions, null values, column aliases, concatenation operators, literal character strings, and alternative quote operators. It also covers restricting and sorting data using WHERE clauses, comparison operators, logical operators, pattern matching, and null conditions.
This document discusses different types of constraints in SQL. It explains that constraints are used to specify rules for data in tables to ensure accuracy and reliability. If a constraint is violated by an action, the action is aborted. There are two types of constraints - column level constraints which apply to a single column, and table level constraints which apply to multiple columns. The document provides examples of different constraint types like primary keys, unique keys, not null constraints, check constraints, and foreign keys. It also discusses concepts like cascading deletes and setting foreign keys to null when the referenced row is deleted.
The document provides an overview of SQL commands and syntax for creating and managing databases, tables, and querying data. Key points covered include:
- SQL commands for defining schema (CREATE TABLE), manipulating data (INSERT, UPDATE, DELETE), and querying data (SELECT).
- Data types, constraints, indexes and joins.
- Examples of SQL syntax for common queries and operations like filtering, sorting, aggregation, and joining tables.
Integrity constraints in SQL are used to define business rules for database tables. The main constraints are primary keys, foreign keys, not null, unique, and check. Primary keys enforce uniqueness of rows while foreign keys enforce relationships between tables by referencing primary keys. Not null ensures columns contain values and unique prevents duplicate values in columns. Check constraints define rules that rows must satisfy. Constraints can be defined at the column or table level.
This document discusses the Data Definition Language (DDL) in 3 main sections. It introduces the 3 basic DDL commands - CREATE, ALTER, and DROP and provides detailed syntax examples for creating and modifying tables, views, columns using these commands. Specific examples shown include creating a table with columns, creating a table by selecting columns from other tables, adding, modifying and dropping columns from tables, and creating, updating and dropping views.
This document provides an overview of SQL (Structured Query Language) concepts including data definition and manipulation commands, data types, constraints, joins, aggregate and scalar functions. Key topics covered include using DDL commands to create and modify database tables, DML commands to insert, update, delete and select data, and SQL clauses like WHERE, ORDER BY, GROUP BY and more. The document also discusses database concepts like primary keys, foreign keys, indexes and constraints.
Oracle database is a relational database management system. The CREATE TABLE statement is used to create new tables with column names and data types. The ALTER TABLE statement modifies existing table structures by adding, dropping or modifying columns.
The document discusses various schema object management techniques in Oracle including:
1) Adding, modifying, and dropping columns using the ALTER TABLE statement.
2) Adding constraints such as primary keys, foreign keys, and indexes.
3) Creating function-based indexes and dropping indexes.
4) Using Flashback operations to restore tables.
5) Creating and querying external tables stored in operating system files.
This document discusses SQL constraints. It defines constraints as limitations on the type of data that can go into a table. The main types of constraints covered are:
1. Not null constraints, which enforce that a column cannot be null
2. Unique constraints, which uniquely identify each record in a table
3. Primary key constraints, which uniquely identify each record and cannot be null
4. Foreign key constraints, which link to primary keys in other tables to define relationships
5. Check constraints, which define valid value ranges for a column
6. Default constraints, which provide a default value for a column if no other value is specified.
Examples are provided for each constraint type to illustrate their syntax and usage
The document describes Data Definition Language (DDL) commands in SQL. It explains that DDL allows the specification of relations, schemas, domains, integrity constraints, indices, security, and storage structures. The core DDL commands are CREATE, ALTER, and DROP. CREATE is used to define new tables with columns, data types, primary keys, foreign keys and other constraints. ALTER modifies existing tables by adding, dropping, renaming columns or modifying column properties. DROP removes tables from the database. Examples are provided for each command demonstrating how to define, modify and remove tables for a university database schema.
Constraints enforce rules at the table level to maintain data integrity. The main types of constraints are NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, and CHECK. Constraints can be created at table or column level using the CREATE TABLE or ALTER TABLE statements. Data dictionary views like USER_CONSTRAINTS and USER_CONS_COLUMNS can be queried to view existing constraint definitions and their associated columns.
Difference Between Sql - MySql and OracleSteve Johnson
The document compares and contrasts SQL, MySQL, and Oracle databases. It discusses the definitions of SQL, MySQL, and Oracle and how they are different types of database management systems. It also provides examples of how to create tables, define primary keys, add foreign keys, create indexes, drop tables, and alter tables using SQL, MySQL, and Oracle syntax.
The document discusses how to create and manage database tables. Key topics covered include using CREATE TABLE to define table structure, ALTER TABLE to modify tables, DROP TABLE to remove tables, and TRUNCATE TABLE to delete all rows. Datatypes, naming conventions, adding comments, and joining tables with subqueries are also summarized.
This document discusses how to create, manage, and modify database tables in Oracle. The key points covered include how to create tables with column definitions and datatypes, alter tables by adding, modifying or dropping columns, rename and truncate tables, and add comments to tables. Operations like create, alter, drop, and truncate allow managing the structure of tables, while comments provide descriptive information.
This document discusses different types of constraints in SQL including not null, unique key, primary key, foreign key, check key, and default key. It provides the syntax for creating constraints and examples of each constraint type. The examples show the creation of tables for customers, products, and sales with the appropriate constraints defined. Integrity constraints are used to prohibit illegal data and ensure referential integrity between tables.
This document provides an overview of common Oracle PL/SQL commands and concepts for working with tables, views, users, indexes, sequences, synonyms, roles, functions, procedures, triggers, collections, implicit and explicit cursors, data types, and the data dictionary. It includes commands for creating, altering, dropping and managing database objects as well as SQL statements for queries, DML, joins and collections.
The document discusses how to create a database and tables in SQL using DDL statements like CREATE, DROP, and ALTER. It explains that CREATE is used to define new database objects, DROP removes objects, and ALTER modifies objects. Specific examples show how to create a database called ABCCO, and tables like Persons with columns for ID, name, city. It also covers defining primary keys, foreign keys, default and null values when creating tables.
The document provides information on various SQL commands used to create and manage databases and tables. It explains how to use SHOW, CREATE DATABASE, USE, SHOW TABLES, CREATE TABLE, DESCRIBE, ALTER TABLE, SELECT, UPDATE, DELETE, INSERT, CREATE VIEW commands. It also discusses table constraints like NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY and provides examples of how to implement them in CREATE TABLE and ALTER TABLE statements.
This document provides a summary of SQL commands and functions for Oracle SQL and SQL Server in 3 sentences or less per section. It covers common queries, data modification, joins, table creation, constraints, indexes, set operators, window functions, subqueries, case statements, common table expressions, aggregate functions, and common functions.
SQL stands for Structured Query Language.
SQL is a database management language for relational databases.
SQL lets you access and manipulate databases.
Similar to Lecture 4 sql {basics keys and constraints} (20)
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
1. LECTURE -4
S T R U C T U R E D Q U E R Y L A N G U A G E
( K E Y S & C O N S T R A I N T S )
D e l i v e r e d B y :
M r . S h u b h a m S h u k l a
2. PRIMARY KEYS
Note
• In Oracle, a primary key can not contain more than 32 columns.
• A primary key can be defined in either a CREATE TABLE statement or an ALTER TABLE
statement.
Create Primary Key - Using CREATE TABLE statement
Syntax
CREATE TABLE table_name
(
column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ... column_n)
);
4. Create Primary Key - Using ALTER TABLE statement
Syntax
ALTER TABLE table_name
ADD CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ...
column_n);
Example
ALTER TABLE supplier
ADD CONSTRAINT supplier_pk PRIMARY KEY (supplier_id);
5. • Drop Primary Key
Syntax
• ALTER TABLE table_name DROP CONSTRAINT constraint_name;
Example:
ALTER TABLE supplier DROP CONSTRAINT supplier_pk;
6. Disable Primary Key
Syntax
ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;
Example
ALTER TABLE supplier
DISABLE CONSTRAINT supplier_pk;
Enable Primary Key
Syntax
ALTER TABLE table_name
ENABLE CONSTRAINT constraint_name;
Example
ALTER TABLE supplier
ENABLE CONSTRAINT supplier_pk;
7. FOREIGN KEYS
• A foreign key is a way to enforce referential integrity within your Oracle
database. A foreign key means that values in one table must also appear in
another table.
• The referenced table is called the parent table while the table with the foreign
key is called the child table. The foreign key in the child table will generally
reference a primary key in the parent table.
13. For example:
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id) );
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
ON DELETE CASCADE );
14. Using an ALTER TABLE statement
Syntax
ALTER TABLE table_name
ADD CONSTRAINT constraint_name
FOREIGN KEY (column1, column2, ... column_n)
REFERENCES parent_table (column1, column2, ... column_n)
ON DELETE CASCADE;
For example:
ALTER TABLE products
ADD CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
ON DELETE CASCADE;
15. Foreign Keys with Set Null on Delete
A foreign key with "set null on delete" means that if a record in the parent table is deleted, then
the corresponding records in the child table will have the foreign key fields set to null. The
records in the child table will not be deleted.
Using a CREATE TABLE statement
Syntax
CREATE TABLE table_name
( column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT fk_column
FOREIGN KEY (column1, column2, ... column_n)
REFERENCES parent_table (column1, column2, ... column_n)
ON DELETE SET NULL );
16. Example
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
);
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10),
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
ON DELETE SET NULL
);
17. Using an ALTER TABLE statement
Syntax
ALTER TABLE table_name
ADD CONSTRAINT constraint_name
FOREIGN KEY (column1, column2, ... column_n)
REFERENCES parent_table (column1, column2, ... column_n)
ON DELETE SET NULL;
Example
ALTER TABLE products
ADD CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
ON DELETE SET NULL;
18. • Drop a Foreign Key
Syntax
ALTER TABLE table_name
DROP CONSTRAINT constraint_name;
ALTER TABLE products
DROP CONSTRAINT fk_supplier;
19. • Disable a foreign key
Syntax
ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;
For Example:
ALTER TABLE products
DISABLE CONSTRAINT fk_supplier;
• Enable a foreign key
Syntax
ALTER TABLE table_name
ENABLE CONSTRAINT constraint_name;
For Example:
ALTER TABLE products
ENABLE CONSTRAINT fk_supplier;
20. UNIQUE CONSTRAINTS
• A unique constraint is a single field or combination of fields that uniquely defines a record.
Some of the fields can contain null values as long as the combination of values is unique.
Using a CREATE TABLE statement
CREATE TABLE table_name
(
column1 datatype [ NULL | NOT NULL ],
column2 datatype [ NULL | NOT NULL ],
...
CONSTRAINT constraint_name UNIQUE (uc_col1, uc_col2, ... uc_col_n)
);
21. For example:
CREATE TABLE supplier
( supplier_id numeric(10) NOT NULL,
supplier_name varchar2(50) NOT NULL,
contact_name varchar2(50),
CONSTRAINT supplier_unique UNIQUE (supplier_id)
);
22. Using an ALTER TABLE statement
ALTER TABLE table_name
ADD CONSTRAINT constraint_name UNIQUE (column1, column2, ... column_n);
Example:
ALTER TABLE supplier
ADD CONSTRAINT supplier_unique UNIQUE (supplier_id);
Drop Unique Constraint
ALTER TABLE table_name
DROP CONSTRAINT constraint_name;
Example
ALTER TABLE supplier
DROP CONSTRAINT supplier_unique;
23. Disable Unique Constraint
ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;
Example:
ALTER TABLE supplier
DISABLE CONSTRAINT supplier_unique;
Enable Unique Constraint
ALTER TABLE table_name
ENABLE CONSTRAINT constraint_name;
Example:
ALTER TABLE supplier
ENABLE CONSTRAINT supplier_unique;
24. CHECK CONSTRAINTS
• A check constraint allows you to specify a condition on each row in a table.
Note
• A check constraint can NOT be defined on a SQL View.
• The check constraint defined on a table must refer to only columns in that table.
It can not refer to columns in other tables.
• A check constraint can NOT include a SQL Subquery.
• A check constraint can be defined in either a SQL CREATE TABLE
statement or a SQL ALTER TABLE statement.
25. Using a CREATE TABLE statement
CREATE TABLE table_name
(
column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT constraint_name CHECK (column_name condition) [DISABLE]
);
Example
CREATE TABLE suppliers
(
supplier_id numeric(4),
supplier_name varchar2(50),
CONSTRAINT check_supplier_id
CHECK (supplier_id BETWEEN 100 and 9999)
);
26. Using an ALTER TABLE statement
ALTER TABLE table_name
ADD CONSTRAINT constraint_name CHECK (column_name condition) [DISABLE];
Example
ALTER TABLE suppliers
ADD CONSTRAINT check_supplier_name
CHECK (supplier_name IN ('IBM', 'Microsoft', 'NVIDIA'));
Drop a Check Constraint
ALTER TABLE table_name
DROP CONSTRAINT constraint_name;
Example
ALTER TABLE suppliers
DROP CONSTRAINT check_supplier_id;
27. Enable a Check Constraint
ALTER TABLE table_name
ENABLE CONSTRAINT constraint_name;
Example
ALTER TABLE suppliers
ENABLE CONSTRAINT check_supplier_id;
Disable a Check Constraint
ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;
Example
ALTER TABLE suppliers
DISABLE CONSTRAINT check_supplier_id;