Skip to content

Commit

Permalink
deploy: 2e11c6a
Browse files Browse the repository at this point in the history
  • Loading branch information
peymanslh committed Feb 3, 2024
1 parent eddc051 commit e7b0a93
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
in most popular RDBMSs and be as short as possible and refference to
a reliable source for more info. You can set up your environment and import sample data in the
<a href=./posts/setup>Setup</a> post. If you find any issues or want to add more examples,
feel free to open an issue or send a pull request in <a href=https://github.com/peymanslh/sql>GitHub</a>.</p></div></div><h2>Introduction <span class=dot></span></h2><ul class=home-posts><li><a href=./posts/setup/>Setup</a></li><li><a href=./posts/sample-database-structure/>Sample Database Structure</a></li></ul><h2>Database and Table Management<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/create-and-drop-database/>Create and Drop Database</a></li><li><a href=./posts/create-and-drop-table/>Create and Drop Table</a></li></ul><h2>Modifying Data<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/insert/>INSERT</a></li><li><a href=./posts/update/>UPDATE</a></li><li><a href=./posts/delete/>DELETE</a></li></ul><h2>Query and Filtering Data<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/select/>SELECT</a></li><li><a href=./posts/where/>WHERE</a></li><li><a href=./posts/order-by/>ORDER BY</a></li><li><a href=./posts/group-by/>GROUP BY</a></li><li><a href=./posts/and-or-not/>AND, OR, NOT</a></li><li><a href=./posts/limit/>LIMIT</a></li></ul><h2>Latest Posts<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/limit/>LIMIT</a></li><li><a href=./posts/and-or-not/>AND, OR, NOT</a></li><li><a href=./posts/group-by/>GROUP BY</a></li><li><a href=./posts/order-by/>ORDER BY</a></li><li><a href=./posts/delete/>DELETE</a></li><li><a href=./posts/update/>UPDATE</a></li><li><a href=./posts/insert/>INSERT</a></li><li><a href=./posts/where/>WHERE</a></li><li><a href=./posts/select/>SELECT</a></li><li><a href=./posts/create-and-drop-table/>Create and Drop Table</a></li><li><a href=./posts/create-and-drop-database/>Create and Drop Database</a></li><li><a href=./posts/sample-database-structure/>Sample Database Structure</a></li><li><a href=./posts/setup/>Setup</a></li></ul><div class=footer><div class=footer-copy>© 2024 SQL by example.</div><div class=footer-social><span class="social-icon social-icon-github"><a href=https://github.com/peymanslh/sql title=github target=_blank rel=noopener><img src=./images/social/github.svg width=24 height=24 alt=github></a></span></div></div></div><script type=text/javascript src=./js/bundle.min.1ff4c3efa6718e4b48bf69ba81bb9b232f6f3e1407b7ea6ce8e5a6fdaed5af56.js></script></body></html>
feel free to open an issue or send a pull request in <a href=https://github.com/peymanslh/sql>GitHub</a>.</p></div></div><h2>Introduction <span class=dot></span></h2><ul class=home-posts><li><a href=./posts/setup/>Setup</a></li><li><a href=./posts/sample-database-structure/>Sample Database Structure</a></li><li><a href=./posts/comment/>Comment</a></li></ul><h2>Database and Table Management<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/create-and-drop-database/>Create and Drop Database</a></li><li><a href=./posts/create-and-drop-table/>Create and Drop Table</a></li></ul><h2>Modifying Data<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/insert/>INSERT</a></li><li><a href=./posts/update/>UPDATE</a></li><li><a href=./posts/delete/>DELETE</a></li></ul><h2>Query and Filtering Data<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/select/>SELECT</a></li><li><a href=./posts/where/>WHERE</a></li><li><a href=./posts/order-by/>ORDER BY</a></li><li><a href=./posts/group-by/>GROUP BY</a></li><li><a href=./posts/and-or-not/>AND, OR, NOT</a></li><li><a href=./posts/limit/>LIMIT</a></li><li><a href=./posts/min-max/>MIN, MAX</a></li></ul><h2>Latest Posts<span class=dot></span></h2><ul class=home-posts><li><a href=./posts/min-max/>MIN, MAX</a></li><li><a href=./posts/comment/>Comment</a></li><li><a href=./posts/limit/>LIMIT</a></li><li><a href=./posts/and-or-not/>AND, OR, NOT</a></li><li><a href=./posts/group-by/>GROUP BY</a></li><li><a href=./posts/order-by/>ORDER BY</a></li><li><a href=./posts/delete/>DELETE</a></li><li><a href=./posts/update/>UPDATE</a></li><li><a href=./posts/insert/>INSERT</a></li><li><a href=./posts/where/>WHERE</a></li><li><a href=./posts/select/>SELECT</a></li><li><a href=./posts/create-and-drop-table/>Create and Drop Table</a></li><li><a href=./posts/create-and-drop-database/>Create and Drop Database</a></li><li><a href=./posts/sample-database-structure/>Sample Database Structure</a></li><li><a href=./posts/setup/>Setup</a></li></ul><div class=footer><div class=footer-copy>© 2024 SQL by example.</div><div class=footer-social><span class="social-icon social-icon-github"><a href=https://github.com/peymanslh/sql title=github target=_blank rel=noopener><img src=./images/social/github.svg width=24 height=24 alt=github></a></span></div></div></div><script type=text/javascript src=./js/bundle.min.1ff4c3efa6718e4b48bf69ba81bb9b232f6f3e1407b7ea6ce8e5a6fdaed5af56.js></script></body></html>
4 changes: 3 additions & 1 deletion index.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Learn SQL by example on SQL by example</title><link>https://peyman.blog/sql/</link><description>Recent content in Learn SQL by example on SQL by example</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>[email protected] (Peyman Salehi)</managingEditor><webMaster>[email protected] (Peyman Salehi)</webMaster><lastBuildDate>Fri, 02 Feb 2024 15:09:44 +0330</lastBuildDate><atom:link href="https://peyman.blog/sql/index.xml" rel="self" type="application/rss+xml"/><item><title>LIMIT</title><link>https://peyman.blog/sql/posts/limit/</link><pubDate>Fri, 02 Feb 2024 15:09:44 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/limit/</guid><description>When the number of rows in a select query are a lot, we can limit them by the LIMIT statement.
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Learn SQL by example on SQL by example</title><link>https://peyman.blog/sql/</link><description>Recent content in Learn SQL by example on SQL by example</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>[email protected] (Peyman Salehi)</managingEditor><webMaster>[email protected] (Peyman Salehi)</webMaster><lastBuildDate>Sat, 03 Feb 2024 15:49:57 +0330</lastBuildDate><atom:link href="https://peyman.blog/sql/index.xml" rel="self" type="application/rss+xml"/><item><title>MIN, MAX</title><link>https://peyman.blog/sql/posts/min-max/</link><pubDate>Sat, 03 Feb 2024 15:49:57 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/min-max/</guid><description>MIN returns the smallest value of a column. MAX returns the biggest value of a column.
-- return the lowest total_price from orders of user with id of 10 SELECT MIN(total_price) FROM orders WHERE user_id = 10; -- +------+ -- | min | -- |------| -- | 1132 | -- +------+ -- return the highest total_price from the orders of user with id of 10 SELECT MAX(total_price) FROM orders WHERE user_id = 10; -- +------+ -- | max | -- |------| -- | 1998 | -- +------+ PostgreSQL docs</description></item><item><title>Comment</title><link>https://peyman.blog/sql/posts/comment/</link><pubDate>Sat, 03 Feb 2024 15:11:15 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/comment/</guid><description>When you writing multiline SQL queries you can use -- to comment a single line and use /* */ to comment multiline texts.
-- Single line comment /* Multi line comment */</description></item><item><title>LIMIT</title><link>https://peyman.blog/sql/posts/limit/</link><pubDate>Fri, 02 Feb 2024 15:09:44 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/limit/</guid><description>When the number of rows in a select query are a lot, we can limit them by the LIMIT statement.
-- only return 3 item SELECT * FROM users LIMIT 3; -- +----+---------------------+------------+-----------+--------------------------------+----------------+--------+ -- | id | datetime_joined | first_name | last_name | email | city | active | -- |----+---------------------+------------+-----------+--------------------------------+----------------+--------| -- | 1 | 2023-08-18 21:44:13 | Carmen | Malone | [email protected] | East Jeanmouth | True | -- | 2 | 2023-07-27 04:31:11 | Stephanie | Wallace | hjennings@curry.</description></item><item><title>AND, OR, NOT</title><link>https://peyman.blog/sql/posts/and-or-not/</link><pubDate>Fri, 02 Feb 2024 14:18:01 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/and-or-not/</guid><description>With the help of AND, OR, and NOT we can add more power to our query conditions.
-- select all orders with product_id of 10 and delivered -- only select rows where both conditions are true SELECT * FROM orders WHERE product_id = &amp;#39;10&amp;#39; AND delivered = true; -- +-----+---------------------+--------------------------------------+------------+---------+----------+-------------+-----------+ -- | id | created_at | order_code | product_id | user_id | quantity | total_price | delivered | -- |-----+---------------------+--------------------------------------+------------+---------+----------+-------------+-----------| -- | 113 | 2023-07-08 21:09:44 | 12f82968-46fc-4118-9c58-fb568c38fa4e | 10 | 343 | 1 | 445 | True | -- | 121 | 2023-06-03 00:18:42 | 24d070f9-2e4b-4b41-8d76-c99167083405 | 10 | 239 | 8 | 3560 | True | -- | 487 | 2023-07-04 06:34:56 | 23da1388-e818-48af-ab5b-bc14951a22e0 | 10 | 41 | 5 | 2225 | True | -- | 774 | 2023-04-20 09:35:38 | 07bbf026-ef4f-4078-a919-48702af47cb0 | 10 | 67 | 3 | 1335 | True | -- +-----+---------------------+--------------------------------------+------------+---------+----------+-------------+-----------+ -- select all users where their first or last name is John -- select rows where only one of the conditions are true SELECT * FROM users WHERE first_name = &amp;#39;John&amp;#39; OR last_name = &amp;#39;John&amp;#39;; -- +-----+---------------------+------------+-----------+------------------------------+-----------------+--------+ -- | id | datetime_joined | first_name | last_name | email | city | active | -- |-----+---------------------+------------+-----------+------------------------------+-----------------+--------| -- | 14 | 2022-12-18 03:47:51 | John | Combs | katherinewiley@myers.</description></item><item><title>GROUP BY</title><link>https://peyman.blog/sql/posts/group-by/</link><pubDate>Fri, 12 Jan 2024 15:40:37 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/group-by/</guid><description>GROUP BY comblines the output into groups of rows that matches on one or multiple values. Also, GROUP BY usually used with aggregate functions like COUNT, MIN, MAX, SUM, and AVG.
-- count number of products for each company SELECT COUNT(id), company FROM products GROUP BY company; -- +-------+---------------------------------+ -- | count | company | -- |-------+---------------------------------| -- | 1 | Edwards, Fox and Valentine | -- | 2 | Hale-Bryan | -- | 1 | Alexander Inc | -- | 1 | Stark and Sons | -- | 2 | Martin, Baker and Henderson | -- .</description></item><item><title>ORDER BY</title><link>https://peyman.blog/sql/posts/order-by/</link><pubDate>Wed, 03 Jan 2024 23:55:35 +0330</pubDate><author>[email protected] (Peyman Salehi)</author><guid>https://peyman.blog/sql/posts/order-by/</guid><description>In a select query, after choosing the columns and adding some conditions we can choose the ordering of the output data based on a columns which can be an integer, datetime or some other kinds of sortable data types.
Expand Down
7 changes: 7 additions & 0 deletions posts/comment/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="ie=edge"><title>Comment - SQL by example</title><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=https://peyman.blog/sql/favicon.png><link rel=alternate type=application/rss+xml href=https://peyman.blog/sql/index.xml title="SQL by example"><link rel=stylesheet href=../../css/style.min.b7a8f934af918fc60a41bae619210b3560306dbdbba86726567d6993bc1bc64c.css><meta property="og:title" content="Comment"><meta property="og:type" content="website"><meta property="og:url" content="https://peyman.blog/sql/posts/comment/"><meta name=twitter:card content="summary"><meta name=twitter:site content="@_peymanslh"><meta name=twitter:creator content="@_peymanslh"><link rel=preconnect href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,500;0,700;1,500&family=Libre+Caslon+Text:wght@700&family=Pridi:wght@300;400;600;700&display=swap" rel=stylesheet></head><body class="page page-blog-single"><div id=wrapper class=wrapper><div class=header><a class=header-logo href=https://peyman.blog/sql/>SQL by example</a><div class=menu-main><ul><li class=menu-item-about><a href=../../pages/about/>About</a></li><li class=menu-item-posts><a href=../../posts/>Posts</a></li></ul></div></div><div class=blog><div class=intro><h1>Comment<span class=dot></span></h1><ul class=post-tags><li><a href=https://peyman.blog/sql/tags/intro/>intro</a></li><li><a href=https://peyman.blog/sql/tags/postgresql/>postgresql</a></li></ul></div><div class=content><p>When you writing multiline SQL queries you can use <code>--</code> to comment a single line and
use <code>/* */</code> to comment multiline texts.</p><div class=highlight><pre style=color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-sql data-lang=sql><span style=color:#616e87;font-style:italic>-- Single line comment
</span><span style=color:#616e87;font-style:italic></span>
<span style=color:#616e87;font-style:italic>/* Multi
</span><span style=color:#616e87;font-style:italic>line comment
</span><span style=color:#616e87;font-style:italic>*/</span>
</code></pre></div></div></div><div class=footer><div class=footer-copy>© 2024 SQL by example.</div><div class=footer-social><span class="social-icon social-icon-github"><a href=https://github.com/peymanslh/sql title=github target=_blank rel=noopener><img src=../../images/social/github.svg width=24 height=24 alt=github></a></span></div></div></div><script type=text/javascript src=../../js/bundle.min.1ff4c3efa6718e4b48bf69ba81bb9b232f6f3e1407b7ea6ce8e5a6fdaed5af56.js></script></body></html>
Loading

0 comments on commit e7b0a93

Please sign in to comment.