summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTh3G33k <666th3g33k666@monmail.fr.nf>2024-04-27 00:10:02 -1000
committerGitHub <noreply@github.com>2024-04-27 03:10:02 -0700
commit2c0eb04886dff42bb530f89ca386f4f119828f60 (patch)
treec22f9969f3aeb7cb12ac3f3feb374c2a3fdd918e
parentb6bc1197b04d5a803ea4cb2fdee15cb42b79d76b (diff)
[sql/en] fix semicolons (#4915)
-rw-r--r--sql.html.markdown17
1 files changed, 9 insertions, 8 deletions
diff --git a/sql.html.markdown b/sql.html.markdown
index 19eae60f..c317a433 100644
--- a/sql.html.markdown
+++ b/sql.html.markdown
@@ -4,6 +4,7 @@ filename: learnsql.sql
contributors:
- ["Bob DuCharme", "http://bobdc.com/"]
- ["Th3G33k", "https://github.com/Th3G33k"]
+
---
Structured Query Language (SQL) is an [ISO/IEC 9075](https://www.iso.org/standard/63555.html) standard language for creating and working with databases stored in a set of tables. Implementations usually add their own extensions to the language; [Comparison of different SQL implementations](http://troels.arvin.dk/db/rdbms/) is a good reference on product differences.
@@ -65,16 +66,16 @@ SELECT DISTINCT title FROM titles ORDER BY title ASC;
-- Use the comparison operators (=, >, <, >=, <=, <>) and
-- the conditional keywords (AND, OR) to refine your queries.
-SELECT * FROM departments WHERE dept_no = 'd001' OR dept_no = 'd002'
+SELECT * FROM departments WHERE dept_no = 'd001' OR dept_no = 'd002';
-- Same as above.
-SELECT * FROM departments WHERE dept_no IN ('d001', 'd0002')
+SELECT * FROM departments WHERE dept_no IN ('d001', 'd002');
-- Opposite of the above.
-SELECT * FROM departments WHERE dept_no NOT IN ('d001', 'd0002')
+SELECT * FROM departments WHERE dept_no NOT IN ('d001', 'd002');
-- Select in a given range.
-SELECT * from departments WHERE dept_no BETWEEN 'd001' AND 'd0002'
+SELECT * from departments WHERE dept_no BETWEEN 'd001' AND 'd002';
-- Show the number of rows in the departments table.
SELECT COUNT(*) FROM departments;
@@ -91,15 +92,15 @@ SELECT COUNT(*) FROM departments WHERE dept_name LIKE '%en%';
-- Retrieve the total number of employees, by department number,
-- with the condition of having more than 100 employees.
SELECT dept_no, COUNT(dept_no) FROM dept_emp GROUP BY dept_no
-HAVING COUNT(dept_no) > 100
+HAVING COUNT(dept_no) > 100;
-- Aliases, using the optional keyword AS, can be used for column/table names.
SELECT COUNT(A.*) AS total_employees, COUNT(B.*) total_departments
-FROM employees AS A, departments B
+FROM employees AS A, departments B;
-- Common date format is "yyyy-mm-dd".
-- However, it can vary according to the implementation, the operating system, and the session's locale.
-SELECT * FROM dept_manager WHERE from_date >= '1990-01-01'
+SELECT * FROM dept_manager WHERE from_date >= '1990-01-01';
-- A JOIN of information from multiple tables: the titles table shows
-- who had what job titles, by their employee numbers, from what
@@ -117,7 +118,7 @@ FROM titles INNER JOIN employees ON
-- UNION selects distinct rows, UNION ALL selects all rows.
SELECT * FROM departments WHERE dept_no = 'd001'
UNION
-SELECT * FROM departments WHERE dept_no = 'd002'
+SELECT * FROM departments WHERE dept_no = 'd002';
-- SQL syntax order is:
-- SELECT _ FROM _ JOIN _ ON _ WHERE _ GROUP BY _ HAVING _ ORDER BY _ UNION