1. SELECT user_id, username FROM Users WHERE user_id IN (SELECT user_id FROM Orders WHERE order_date > '2023-01-01'));
2. SELECT product_id, AVG(price) AS avg_price FROM Products GROUP BY product_id HAVING AVG(price) > 10;
3. SELECT product_id, AVG(price) AS avg_price FROM Products where price > 10 GROUP BY product_id
4. SELECT user_id, username FROM Users UNION SELECT user_id, username FROM Admins;
5. SELECT Users.username, Orders.order_date, Products.product_name FROM Users JOIN Orders ON Users.user_id = Orders.user_id JOIN OrderItems ON Orders.order_id = OrderItems.order_id JOIN Products ON OrderItems.product_id = Products.product_id
6. SELECT * FROM Users WHERE user_id NOT IN (SELECT user_id FROM Orders)
7. SELECT user_id, order_date, total_price, (SELECT AVG(total_price) FROM Orders WHERE user_id = o.user_id) AS avg_order_total FROM Orders o ORDER BY order_date
sql-kata-workshop's Introduction
sql-kata-workshop's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.