This document provides a summary of SQL commands and functions:
- It outlines common SQL statements like SELECT, WHERE, ORDER BY, INSERT, UPDATE, DELETE and JOINs.
- It also describes aggregate functions such as COUNT, AVG, MIN, MAX, SUM that perform calculations on data sets.
- GROUP BY is explained as a way to group rows based on common attributes, and HAVING can be used to filter groups.
- Examples are provided for each concept to illustrate their usage in queries on database tables.
The full document contains detailed explanations and syntax examples of core SQL statements and functions for querying and managing data in relational database systems.
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.
The document provides instructions on how to use SQL to manage a relational database. It describes how to create tables with columns of different data types, insert and update data, retrieve data using SELECT statements with functions like COUNT and ORDER BY, and join tables. The goal is to be able to efficiently store, modify, and query data in a database using the SQL language.
This document provides summaries of SQL statements and concepts including:
1. Select statements with various clauses like WHERE, ORDER BY, GROUP BY, DISTINCT
2. Data definition language statements like CREATE, ALTER, DROP for databases, tables, indexes, views
3. Data manipulation language statements like INSERT, UPDATE, DELETE
4. Joins - equijoin, natural join, cross join
5. Constraints - primary key, foreign key, unique, check, default
SQL is a standard language for accessing and manipulating databases. It allows users to retrieve, insert, update, and delete data as well as create new databases and tables. Common SQL statements include SELECT, UPDATE, DELETE, and INSERT. SQL uses clauses, operators, and wildcards to filter records based on conditions. Some key points are that SQL is an ANSI standard but different versions exist, it allows querying and modifying data in databases, and is essential for interacting with relational database systems.
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 discusses SQL aliases, aggregate functions like AVG(), COUNT(), MAX(), MIN(), and the HAVING clause. It explains that aliases can be used to rename tables and columns in a SELECT statement for brevity. It also describes how aggregate functions return values like the average, count, maximum and minimum of a column. Additionally, it covers that the HAVING clause is used with aggregate functions and GROUP BY to filter groups. The GROUP BY statement is used to group query results by one or more columns.
Marija Jović teaches English in a small elementary school in central Serbia, where she has taught for 9 years to students aged 7 to 15. She enjoys using technology, music, videos and games in her teaching. In her spare time, she runs online educational groups for teachers and students, writes articles about technology in education, and organizes free workshops. She values lifelong learning and connecting with colleagues worldwide.
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.
The document provides instructions on how to use SQL to manage a relational database. It describes how to create tables with columns of different data types, insert and update data, retrieve data using SELECT statements with functions like COUNT and ORDER BY, and join tables. The goal is to be able to efficiently store, modify, and query data in a database using the SQL language.
This document provides summaries of SQL statements and concepts including:
1. Select statements with various clauses like WHERE, ORDER BY, GROUP BY, DISTINCT
2. Data definition language statements like CREATE, ALTER, DROP for databases, tables, indexes, views
3. Data manipulation language statements like INSERT, UPDATE, DELETE
4. Joins - equijoin, natural join, cross join
5. Constraints - primary key, foreign key, unique, check, default
SQL is a standard language for accessing and manipulating databases. It allows users to retrieve, insert, update, and delete data as well as create new databases and tables. Common SQL statements include SELECT, UPDATE, DELETE, and INSERT. SQL uses clauses, operators, and wildcards to filter records based on conditions. Some key points are that SQL is an ANSI standard but different versions exist, it allows querying and modifying data in databases, and is essential for interacting with relational database systems.
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 discusses SQL aliases, aggregate functions like AVG(), COUNT(), MAX(), MIN(), and the HAVING clause. It explains that aliases can be used to rename tables and columns in a SELECT statement for brevity. It also describes how aggregate functions return values like the average, count, maximum and minimum of a column. Additionally, it covers that the HAVING clause is used with aggregate functions and GROUP BY to filter groups. The GROUP BY statement is used to group query results by one or more columns.
Marija Jović teaches English in a small elementary school in central Serbia, where she has taught for 9 years to students aged 7 to 15. She enjoys using technology, music, videos and games in her teaching. In her spare time, she runs online educational groups for teachers and students, writes articles about technology in education, and organizes free workshops. She values lifelong learning and connecting with colleagues worldwide.
1. JOINS allow users to combine data from two or more tables based on related columns between them. There are different types of joins including inner, left outer, right outer, and full outer joins.
2. GROUP BY is used with aggregate functions to group query results by one or more columns. HAVING is used with GROUP BY to filter groups.
3. UNION combines the results of multiple select statements into a single result set by removing duplicate rows.
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 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.
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.
This document provides an overview of databases and SQL. It discusses key concepts like database structure, normalization, keys, queries, joins, constraints and more. SQL is used to work with relational databases and allows users to define, manipulate and query data. Common SQL commands are explained like SELECT, INSERT, UPDATE, DELETE and more.
AskTom Office Hours about Database MigrationsJasmin Fluri
Oracle AskTom Office Hours Session about Continuous Database Migrations and the first steps on how to automate your Migrations. It shows the preconditions to establish an automation and shows basic examples.
This document provides an overview of SQL and database management. It begins by outlining the learning objectives which are to change database table structures and retrieve data from databases. It then provides examples of SQL queries for altering tables, retrieving data using SELECT statements, and joining tables. It demonstrates queries for selecting, updating, and altering data as well as using functions, operators, and joins. Tables are created and sample data is inserted to demonstrate example queries.
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.
The document discusses various SQL concepts including aggregate functions like MIN(), MAX(), COUNT(), AVG(), and SUM(); the GROUP BY clause; the HAVING clause; different types of joins like inner joins, outer joins, full outer joins; and examples of queries using these concepts.
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.
1. JOINS allow users to combine data from two or more tables based on related columns between them. There are different types of joins including inner, left outer, right outer, and full outer joins.
2. GROUP BY is used with aggregate functions to group query results by one or more columns. HAVING is used with GROUP BY to filter groups.
3. UNION combines the results of multiple select statements into a single result set by removing duplicate rows.
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 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.
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.
This document provides an overview of databases and SQL. It discusses key concepts like database structure, normalization, keys, queries, joins, constraints and more. SQL is used to work with relational databases and allows users to define, manipulate and query data. Common SQL commands are explained like SELECT, INSERT, UPDATE, DELETE and more.
AskTom Office Hours about Database MigrationsJasmin Fluri
Oracle AskTom Office Hours Session about Continuous Database Migrations and the first steps on how to automate your Migrations. It shows the preconditions to establish an automation and shows basic examples.
This document provides an overview of SQL and database management. It begins by outlining the learning objectives which are to change database table structures and retrieve data from databases. It then provides examples of SQL queries for altering tables, retrieving data using SELECT statements, and joining tables. It demonstrates queries for selecting, updating, and altering data as well as using functions, operators, and joins. Tables are created and sample data is inserted to demonstrate example queries.
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.
The document discusses various SQL concepts including aggregate functions like MIN(), MAX(), COUNT(), AVG(), and SUM(); the GROUP BY clause; the HAVING clause; different types of joins like inner joins, outer joins, full outer joins; and examples of queries using these concepts.
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.
1. The document describes creating and altering tables (Salespeople, Customers, Orders) and adding constraints.
2. It provides the SQL queries and answers for various questions on the tables like finding customers with a rating of 100, orders by descending customer number, and salespeople with more than one customer.
3. The questions find information like customers in San Jose, orders by a specific salesperson, and sums of order amounts grouped by date.
The document describes various SQL queries and concepts. It includes examples of:
- Joining multiple tables to retrieve related data
- Aggregating data using functions like SUM and GROUP BY
- Using subqueries and CTEs to filter and derive data
- Inserting data using a SELECT query
- Creating views and functions for reuse
- Using a cursor to iterate through a result set and perform updates
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfflufftailshop
When it comes to unit testing in the .NET ecosystem, developers have a wide range of options available. Among the most popular choices are NUnit, XUnit, and MSTest. These unit testing frameworks provide essential tools and features to help ensure the quality and reliability of code. However, understanding the differences between these frameworks is crucial for selecting the most suitable one for your projects.
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
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.
Main news related to the CCS TSI 2023 (2023/1695)Jakub Marek
An English 🇬🇧 translation of a presentation to the speech I gave about the main changes brought by CCS TSI 2023 at the biggest Czech conference on Communications and signalling systems on Railways, which was held in Clarion Hotel Olomouc from 7th to 9th November 2023 (konferenceszt.cz). Attended by around 500 participants and 200 on-line followers.
The original Czech 🇨🇿 version of the presentation can be found here: https://www.slideshare.net/slideshow/hlavni-novinky-souvisejici-s-ccs-tsi-2023-2023-1695/269688092 .
The videorecording (in Czech) from the presentation is available here: https://youtu.be/WzjJWm4IyPk?si=SImb06tuXGb30BEH .
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
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!
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.
2. Select
Select Dinstict
Where
And – Or
Order by
Insert Into
Update
Delete
Sajt http://www.w3school.com
3. CustomerID Customer
Name
Contact
Name
Address City Postal
Code
Country
1 Alfreds Futterkiste Maria
Anders
Obere Str. 57 Berlin 12209 Germany
2 Ana Trujillo
Emparedados y helados
Ana Trujillo Avda. de la
Constitución
2222
México D.F. 05021 Mexico
3 Antonio Moreno Taquería Antonio
Moreno
Mataderos 2312 México D.F. 05023 Mexico
4 Around the Horn Thomas
Hardy
120 Hanover Sq. London WA1 1DP UK
5 Berglunds snabbköp Christina
Berglund
Berguvsvägen 8 Luleå S-958 22 Sweden
Customers
6. SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
PRIMERI
SELECT * FROM Customers WHERE Country='Mexico';
SELECT * FROM Customers WHERE CustomerID=1;
Operator Description
= JEDNAKO
<> RAZLIČITO. Note: U NEKIM VERZIJAMA MOŽE
DA SE PIŠE I KAO !=
> VEĆE
< MANJE
>= VEĆE ILI JEDNAKO
<= MANJE ILI JEDNAKO
BETWEE
N
IZMEĐU UJ OPSEGU VREDNOSTI
LIKE PRETRAGA PO OBRASCU
IN VIŠE MOGUĆIH VREDNOSTI ZA KOLONU
7. And i Or koriste se filtriranje unosa koji imaju više od jednog
uslova
PRIMERI
SELECT * FROM Customers WHERE Country='Germany' AND
City='Berlin';
SELECT * FROM Customers WHERE City='Berlin' OR
City='München';
SELECT * FROM Customers WHERE Country='Germany' AND
(City='Berlin' OR City='München');
8. SELECT column_name,column_name
FROM table_name
ORDER BY column_name,column_name ASC|DESC;
PRIMERI
SELECT * FROM Customers ORDER BY Country;
SELECT * FROM Customers ORDER BY Country DESC;
SELECT * FROM Customers ORDER BY Country,CustomerName;
9. Unos novih vrednosti u tabelu
INSERT INTO table_name
VALUES (value1,value2,value3,...);
ILI
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
PRIMERI
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode,
Country)
VALUES ('Cardinal','Tom B. Erichsen','Skagen 21','Stavanger','4006','Norway');
INSERT INTO Customers (CustomerName, City, Country)
VALUES ('Cardinal', 'Stavanger', 'Norway');
PAŽNJA: Vrednosti koje nisu određene unosom generišu u ćelijama NULL
10. Koristi se za ažuriranje već postojećih vrednosti
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
PRIMERI
UPDATE Customers
SET ContactName='Alfred Schmidt', City='Hamburg'
WHERE CustomerName='Alfreds Futterkiste';
UPDATE Customers
SET ContactName='Alfred Schmidt', City='Hamburg';
PAŽNJA: Ako se izostavi WHERE svi zapisi će biti ažurirani
11. DELETE FROM table_name
WHERE some_column=some_value;
PRIMERI
DELETE FROM Customers
WHERE CustomerName='Alfreds Futterkiste' AND
ContactName='Maria Anders';
DELETE FROM table_name;
ILI
DELETE * FROM table_name;
PAŽNJA: Ako se izostavi WHERE briše celu tabelu (pažljivo nema vraćanja sa UNDO)
12. Select Top
Like
In
Between
Aliases
Joins
Inner Join
Right Join
Left Join
Full Join
Union
Sajt http://www.w3school.com
13. SELECT TOP 2 * FROM Customers;
SELECT TOP 50 PERCENT * FROM Customers;
CustomerID Customer
Name
Contact
Name
Address City Postal
Code
Country
1 Alfreds Futterkiste Maria
Anders
Obere Str. 57 Berlin 12209 Germany
2 Ana Trujillo
Emparedados y helados
Ana Trujillo Avda. de la
Constitución
2222
México D.F. 05021 Mexico
3 Antonio Moreno
Taquería
Antonio
Moreno
Mataderos 2312 México D.F. 05023 Mexico
4 Around the Horn Thomas
Hardy
120 Hanover Sq. London WA1 1DP UK
5 Berglunds snabbköp Christina
Berglund
Berguvsvägen 8 Luleå S-958 22 Sweden
Customers
14. Koristi kombinaciju redova iz dve ili više tabela
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;
OrderID CustomerID OrderDate
10308 2 1996-09-18
10309 37 1996-09-19
10310 77 1996-09-20
CustomerID CustomerName ContactName Country
1 Alfreds Futterkiste Maria Anders Germany
2 Ana Trujillo
Emparedados y
helados
Ana Trujillo Mexico
3 Antonio Moreno
Taquería
Antonio Moreno Mexico
Orders
Customers
15. INNER JOIN – vraće sve redove iz obe tabele gde pripadaju redovima obe tabele
LEFT JOIN – vraća sve redove iz leve tabele sa uparenim redovima iz desne
tabele
RIGHT JOIN – vraća sve redove iz desne tabele sa uparenim redovima iz leve
tabele
FULL JOIN - vraća sve redove iz leve i iz desne tabele
16. SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
17. SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
PRIMER
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
LEFT JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
18. SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;
PRIMER
SELECT Orders.OrderID, Employees.FirstName
FROM Orders
RIGHT JOIN Employees
ON Orders.EmployeeID=Employees.EmployeeID
ORDER BY Orders.OrderID;
19. SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;
PRIMER
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
FULL OUTER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
20. AVG() – Vraća prosečne vrednosti
COUNT() – Vraća broj redova
FIRST() – Vraća prvu vrednost
LAST() – Vraća poslednju vrednost
MAX() – Vraća najveću vrednost
MIN() – Vraća minimalnu vrednost
SUM() – Vraća ukupnu (sumu) vrednost
21. Vraća prosečne vrednosti određene kolone (numerička vrednost)
SELECT AVG(column_name) FROM table_name
PRIMER
SELECT AVG(Price) AS PriceAverage FROM Products;
SELECT ProductName, Price FROM Products WHERE Price>(SELECT AVG(Price) FROM
Products);
22. Vraća broj kolona po određenom kriterijumu
SELECT COUNT(column_name) FROM table_name;
PRIMER
SELECT COUNT(*) FROM table_name;
SELECT COUNT(CustomerID) AS OrdersFromCustomerID7 FROM Orders WHERE
CustomerID=7;
SELECT COUNT(*) AS NumberOfOrders FROM Orders;
SELECT COUNT(DISTINCT CustomerID) AS NumberOfCustomers FROM Orders;
23. Vraća prvu vrednost selektovane kolone
SELECT FIRST(column_name) FROM table_name;
PRIMER
SELECT FIRST(CustomerName) AS FirstCustomer FROM Customers;
24. Vraća poslednju vrednost selektovane kolone
SELECT LAST(column_name) FROM table_name;
PRIMER
SELECT LAST(CustomerName) AS LastCustomer FROM Customers;
25. Vraća maksimalnu vrednost selektovane kolone
SELECT MAX(column_name) FROM table_name;
PRIMER
SELECT MAX(Price) AS HighestPrice FROM Products;
26. Vraća najmanju vrednost selektovane kolone
SELECT MIN(column_name) FROM table_name;
PRIMER
SELECT MIN(Price) AS SmallestOrderPrice FROM Products;
27. Vraća ukupnu vrednost numeričke kolone
SELECT SUM(column_name) FROM table_name;
PRIMER
SELECT SUM(Quantity) AS TotalItemsOrdered FROM OrderDetails;
28. Omogućava grupisanje vrsta na osnovu zajedničkih vrednosti
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;
PRIMER
SELECT Shippers.ShipperName,COUNT(Orders.OrderID) AS NumberOfOrders
FROM Orders
LEFT JOIN Shippers
ON Orders.ShipperID=Shippers.ShipperID
GROUP BY ShipperName;
29. Koristi se kada ključna reč ne može sa agregatnom funkcijom
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;
Primer1:
SELECT Employees.LastName, COUNT(Orders.OrderID) AS NumberOfOrders
FROM (Orders
INNER JOIN Employees
ON Orders.EmployeeID=Employees.EmployeeID)
GROUP BY LastName
HAVING COUNT(Orders.OrderID) > 10;
30. Primer2:
SELECT Employees.LastName, COUNT(Orders.OrderID) AS NumberOfOrders
FROM Orders
INNER JOIN Employees
ON Orders.EmployeeID=Employees.EmployeeID
WHERE LastName='Davolio' OR LastName='Fuller'
GROUP BY LastName
HAVING COUNT(Orders.OrderID) > 25;