This document provides an overview of keys and joins in SQL. It discusses the different types of keys like primary keys, foreign keys, and unique keys. It also covers the different types of joins like inner joins, outer joins, and self joins. The document provides examples of creating keys and using different join types. It discusses some performance trade-offs between joins and alternatives like using multiple update statements instead of cursors.
UKOUG Tech14 - Getting Started With JSON in the DatabaseMarco Gralike
Presentation used during the UKOUG Tech14 conference in Liverpool (UK) discussing possibilities of the use of, and explaining, the new JSON database functionality in the Oracle 12.1.0.2 database
UKOUG Tech14 - Getting Started With JSON in the DatabaseMarco Gralike
Presentation used during the UKOUG Tech14 conference in Liverpool (UK) discussing possibilities of the use of, and explaining, the new JSON database functionality in the Oracle 12.1.0.2 database
An tutorial for sql learners in very easy way. It contains all the sql commands like ddl, dml, etc. with suitable examples.
at the end there are 3 sets of question with their solution with explanation. each set contains 40+ questions.
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesMarco Gralike
Presentation used during the UKOUG Tech14 conference in Liverpool (UK) discussing possibilities of the use of the 12.1.0.2 In-Memory Column Store option with XMLType data type storage options common to the Oracle 12.1 database
A. Table Basic Data Types- Char, varchar/varchar2, long, number, Fixed Commands to create table Commands for table handling- Alter table, Drop table, Insert records B. Commands for record handling Update, Delete Select with operators like arithmetic, comparison, logical Query Expression operators Ordering the records with orderby Grouping the records C. SQL functions Date, Numeric, Character, conversion Group functions avg, max, min, sum, count Set operations- Union, Union all, intersect, minu
Dig Deeper into WordPress - WD Meetup CairoMohamed Mosaad
Dig deeper into WordPress is a presentation made for Web Designers Meetup in Cairo taken place on 17th Dec 2012.
Signup at WPMonkeys.com to get notified when awesome new WordPress related content is published.
An tutorial for sql learners in very easy way. It contains all the sql commands like ddl, dml, etc. with suitable examples.
at the end there are 3 sets of question with their solution with explanation. each set contains 40+ questions.
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesMarco Gralike
Presentation used during the UKOUG Tech14 conference in Liverpool (UK) discussing possibilities of the use of the 12.1.0.2 In-Memory Column Store option with XMLType data type storage options common to the Oracle 12.1 database
A. Table Basic Data Types- Char, varchar/varchar2, long, number, Fixed Commands to create table Commands for table handling- Alter table, Drop table, Insert records B. Commands for record handling Update, Delete Select with operators like arithmetic, comparison, logical Query Expression operators Ordering the records with orderby Grouping the records C. SQL functions Date, Numeric, Character, conversion Group functions avg, max, min, sum, count Set operations- Union, Union all, intersect, minu
Dig Deeper into WordPress - WD Meetup CairoMohamed Mosaad
Dig deeper into WordPress is a presentation made for Web Designers Meetup in Cairo taken place on 17th Dec 2012.
Signup at WPMonkeys.com to get notified when awesome new WordPress related content is published.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
2. KEYS
Key is a single or combination of multiple fields in a table. It is used to
fetch or retrieve records/data-rows from data table according to the
condition/requirement. Keys are also used to create relationship
among different database tables or views.
2
3. TYPES OF KEYS IN SQL
Candidate key
Super key
Primary key
Alternative key
Foreign key
Unique key
In our company database primary key and foreign keys are used
heavily
3
4. CANDIDATE KEY
Minimum set of attributes used to differentiate records of the table
(sid,cid) candidate key
Subset of (sid,cid) should not be a candidate key.
If candidate key forms with single attribute then the candidate key is
called simple candidate key, otherwise it’s called compound candidate
key.
4
Sid cid Fee
S1 C1 5000
S1 C2 6000
S2 C2 7000
S2 C3 7000
5. PRIMARY KEY
One of the candidate key is primary key. Candidate key with not null
attribute is called primary key.
cid is primary key here – all distinct values with not null constraint.
cid is candidate key also(simple candidate key).
5
Sid cid Fee
S1 C1 5000
S1 C2 6000
S2 C3 7000
S2 C4 8000
6. PRIMARY KEY(Contd.)
A RDBMS can have only one primary key.
No primary key in this table.
Is this table valid for mysql InnoDB engine?
6
Sid cid Fee
S1 C1 5000
S1 C2 6000
S2 C2 7000
S2 C3 7000
7. PRIMARY KEY(Contd.)
In mysql, the InnoDB storage engine always creates a primary key, if
you didn’t specify it explicitly, thus making an extra column you don’t
have access to.
Primary key can be composite.
SYNTAX TO CREATE PRIMARY KEY
CREATE TABLE roll (
id int(11) NOT NULL AUTO_INCREMENT,
surname varchar(100) NOT NULL,
PRIMARY KEY(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
7
8. ALTERNATIVE KEY
All candidates keys accept primary key is alternative key.
Here sid, cid and fee are candidate keys. So if we are considering sid
as a primary key than cid and fee are alternative keys.
8
Sid cid Fee
S1 C1 5000
S1 C2 6000
S2 C3 7000
S2 C4 8000
9. SUPER KEY
Set of attributes used to differentiate records.
Super keys are :- cid , fee , (cid,sid) , (cid,fee) , (sid,fee)
Every candidate key is super key but every super key is not candidate
key.
9
Sid cid Fee
S1 C1 5000
S1 C2 6000
S2 C3 7000
S2 C4 8000
10. UNIQUE KEY
Set of one or more fields/columns of a table that uniquely identify a
record. It is like a primary key but it can accept only one null value
and it cannot have duplicate values.
Can have more than one unique key constraint per table.
One NULL is allowed because null is unique in itself, hence like similar
to primary key.
10
11. UNIQUE KEY(Contd.)
SYNTAX TO CREATE UNIQUE KEY
CREATE TABLE roll (
id int(11) NOT NULL AUTO_INCREMENT,
surname varchar(100) NOT NULL,
PRIMARY KEY(id),
UNIQUE KEY(roll)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Mysql InnoDB engine allows multiple null values for unique keys.
Depending on the storage engine null may or may not be seen as a
unique value.
BDB engine doesn’t allow multiple null whereas MYISAM & InnoDB
engine allows multiple nulls for unique key constraint.
11
12. FOREIGN KEY
A relation r1 may include among it’s attribute the primary key of an
other relation say r2, the attribute is called foreign key from r1
referencing r2.
r1 – referencing relation
r2 – referenced relation
12
13. FOREIGN KEY(Contd.)
CREATE TABLE roll (
id int(11) NOT NULL AUTO_INCREMENT,
surname varchar(100) NOT NULL,
PRIMARY KEY(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE student (
id int(11) NOT NULL AUTO_INCREMENT,
rollno int(11) NOT NULL,
name varchar(100) NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(rollno) REFERENCES roll(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
13
15. REFERENTIAL INTEGRITY CONSTRAINT
ON DELETE NO ACTION
ON DELETE CASCADE
ON DELETE SET NULL
CREATE TABLE student (
id int(11) NOT NULL AUTO_INCREMENT,
rollno int(11) NOT NULL,
name varchar(100) NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(rollno) REFERENCES roll(id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
16. DROP FOREIGN KEY
SHOW CREATE TABLE student; //will give you foreign keys name
tablename_ibfk_[number] //shorthand naming convention for
InnoDB engine
ALTER TABLE student DROP FOREIGN KEY [foreign key name]
16
17. SIMPLE SQL QUERY
SELECT table1.A, table1.B, table2.C
FROM table1, table2
WHERE table1.B = table2.B
GROUP BY(attribute)
HAVING(condition)
ORDER BY(attribute(desc))
17
18. ORDER OF QUERY EXECUTION
6) SELECT table1.A, table1.B, table2.C
1) FROM table1, table2
2) WHERE table1.B = table2.B
3) GROUP BY(attribute)
4) HAVING(condition)
5) ORDER BY(attribute(desc))
18
19. EXECUTION OF AN SQL QUERY
A B
1 2
3 4
5 6
19
A B
2 3
4 5
9 10
A B B C
1 2 2 3
1 2 4 5
1 2 9 10
3 4 2 3
3 4 4 5
3 4 9 10
5 6 2 3
5 6 4 5
5 6 9 10
TABLE 1
TABLE 2
TABLE 1 X TABLE 2
CARTESIAN
PRODUCT
20. TRADE OFF BETWEEN TIME AND SPACE
If a table has 5000000 entries and joins with another table with same
number of entries, then the joined table(table formed with cartesian
product) will contain 25 trillion entries.
Query performances increases with multiple joins but it requires
more resources. Depending on the requirement and availability of
resources, one should how joins should be used.
20
21. JOINS
JOINS are used to combine rows from two or more tables to save
time(improves query performance).
TYPES OF JOINS
INNER JOIN
LEFT OUTER JOIN
OUTER JOIN RIGHT OUTER JOIN
FULL OUTER JOIN
21
22. JOINS(Contd.)
JOINS is nothing but cartesian product of two or more tables
22
A B C
1 2 3
3 1 2
A B C
2 3 4
2 5 1
A B C B C D
1 2 3 2 3 4
1 2 3 2 5 1
3 1 2 2 5 1
3 1 2 2 3 4
R : S :
R JOIN S :
24. JOINS(Contd.)
SELECT person.lastname, person.firstname, orders.orderno
FROM persons INNER JOIN orders
ON persons.pid = orders.pid
SELECT person.lastname, person.firstname, orders.orderno
FROM persons, orders
WHERE persons.pid = orders.pid
24
25. JOINS(Contd.)
EXPLICIT JOIN
SELECT person.lastname, person.firstname, orders.orderno
FROM persons INNER JOIN orders
ON persons.pid = orders.pid
IMPLICIT JOIN (ANSI SQL 92 SYNTAX)
SELECT person.lastname, person.firstname, orders.orderno
FROM persons, orders
WHERE persons.pid = orders.pid
25
26. JOINS(Contd.)
NATURAL JOIN works same as JOIN but it eliminates duplicate
columns after matching
SELECT * FROM student JOIN roll // simple cartesian product
SELECT * FROM student NATURAL JOIN roll; // no duplicates and checks
for matching fields
SELECT * FROM student, roll //duplicates and checks for
WHERE student.id = roll.id; matching fields
26
27. JOINS(Contd.)
SELECT * FROM student, roll; //cartesian product
SELECT * FROM student JOIN roll; //cartesian product
SELECT * FROM student JOIN roll //cartesian product, duplicates, with on
ON student.id = roll.id; condition only relevant data
SELECT * FROM student INNER JOIN roll //cartesian product, duplicates,
ON student.id = roll.id; with on condition only relevant
data, without on condition
only cartesian product
27
28. JOINS(Contd.)
SELECT * FROM roll NATURAL LEFT OUTER JOIN student;
SELECT * FROM roll NATURAL RIGHT OUTER JOIN student;
In MYSQL FULL OUTER JOIN is implemented by UNION of LEFT OUTER JOIN
AND RIGHT OUTER JOIN
28
29. JOINS – SELF JOIN
The SQL SELF JOIN is used to join a table to itself as if the table were
two tables, temporarily renaming at least one table in the SQL
statement.
Name of all employee that are from same location from where A
belong?
29
NAME LOCATION
A New york
B Canada
C New york
Employee :
30. JOINS – SELF JOIN(Contd.)
APPROACH – 1
SELECT location FROM employee WHERE name = ‘A’ ;
SELECT name FROM employee WHERE location = [x];
APPROACH – 2
NESTED QUERY
SELECT name FROM employee WHERE location IN( SELECT location FROM employee
WHERE name = ‘A’);
30
31. JOINS – SELF JOIN(Contd.)
APPROACH – 3
SELF JOIN
SELECT e1.name
FROM employee e1, employee e2
WHERE e1.location = e2.location
AND e2.name = ‘A’;
SELF JOIN must have aliases.
31
NAME LOCATION NAME LOCATION
A New york A New york
B Canada A New york
C New york A New york
A New york B Canada
B Canada B Canada
C New york B Canada
A New york C New york
B Canada C New york
C New york C New york
e1 e2
32. TRIGGERS
A trigger is a statement that the system executes automatically as a side
effect of modification to the database.
SYNTAX FOR TRIGGER CREATION
DELIMITER //
CREATE TRIGGER `insertmasterproducttax` AFTER INSERT ON `producttax`
FOR EACH ROW BEGIN
INSERT INTO transaction.producttax
SET
transaction.producttax.id = NEW.id,
transaction.producttax.product_id = NEW.product_id,
transaction.producttax.taxtype_id = NEW.taxtype_id;
END;
//
DELIMITER;
32
33. MYSQL STORAGE ENGINE
InnoDB – foreign key constraint
transaction support
ACID properties support
MYISAM – no foreign key constraint
no transaction support
Another big difference is concurrency, MYISAM supports table level locking
whereas InnoDB supports row level locking
With MYISAM, a DML statement will obtain an exclusive lock on the table,
and while that lock is held, no other session can perform a SELECT or a
DML operation on that table.
InnoDB is slow but supports commit, savepoint and rollback operations
whereas MYISAM is fast but does not support any of these operations.
33
34. CURSORS
cursor is a database objects to retrieve data from a result set one row
at a time, instead of the T-SQL commands that operate on all the
rows in the result set at one time. We use cursor when we need to
update records in a database table in singleton fashion means row by
row.
Cursor acts as an iterator over a collection of rows in the result set.
The select statement can return multiple rows as a query result. If you
want to process single row at a time then you can define an explicit
cursor for this select statement.
Explicit cursors are memory areas which acts as a handle or pointer to
context area and allows to fetch and process query results row by
row.
34
35. CURSORS(Contd.)
Each time you fetch a row from the cursor, it results in a network
roundtrip, whereas as a normal SELECT query makes only one round
trip, however large the result set is.
Normal select Query fetches all rows in one go while cursor
fetches one row at a time.
35
36. CURSORS(Contd.)
If you have to give a flat hike to your employees using the following
criteria:
Salary between 30000 and 40000 -- 5000 hike
Salary between 40000 and 55000 -- 7000 hike
Salary between 55000 and 65000 -- 9000 hike
In this situation many developers tend to use a cursor, determine
each employee’s salary and update his salary according to the above
formula.
36
38. MULTIPLE UPDATE STATEMENTS
UPDATE [tablename] SET salary =
CASE WHEN salary BETWEEN 30000 AND 40000 THEN salary + 5000
WHEN salary BETWEEN 40000 AND 55000 THEN salary + 7000
WHEN salary BETWEEN 55000 AND 65000 THEN salary + 10000
END
38
39. CURSORS - disadvantages
A cursor is a memory resident set of pointers -- meaning it occupies
memory from your system that may be available for other processes.
Poorly written cursors can completely deplete available memory.
you must release the resources that are allocated to the cursor
variables.
A cursor allow us to use set of result-sets returned by mysql query in
one by one pattern. With the use of cursor we can perform
operations on set of resultset on each returned row.Like you are
fetching multiple data by any operation and you want to operate
those data in loop. so with the use of cursor you can loops through
the results.Cursor is convenient to use when you are performing on a
complex result-set.
39