[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-572209-105":53,"doc-detail-572209-en":127},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","sql-query-cheat-sheet","SQL Query - Cheat Sheet","","Quick reference guide for SQL syntax and common query patterns, written as a personal “cheat sheet” rather than a full tutorial. Covers core statements like CREATE TABLE and INSERT INTO, basic data selection with WHERE, AND/OR logic, wildcards (% and *), IN and BETWEEN, NULL handling, and negation approaches. Also summarizes sorting, distinct selection, limiting results, column aliasing, and several common string and numeric functions such as UPPER, LOWER, ROUND, LENGTH, POSITION, and TRIM.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":51,"@type":70,"position":76},"https://docshare.wps.com/template/general/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/sql-query-cheat-sheet/572209/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/sql-query-cheat-sheet/572209.png","ImageObject",442,249,{"name":88,"@type":89},"Bintang","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",8,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"What quoting and statement rules does the cheat sheet recommend for SQL?","Question",{"text":109,"@type":110},"Use single quotation marks for most string/date scenarios. Follow each statement with a semicolon; if a statement is alone, the semicolon rule is less relevant.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How does the cheat sheet explain filtering with WHERE using wildcards and ranges?",{"text":114,"@type":110},"It shows % as a partial wildcard (e.g., LIKE '%ind%') and demonstrates BETWEEN for numeric ranges, plus BETWEEN for date ranges using single quotes for date literals.",{"name":116,"@type":107,"acceptedAnswer":117},"How are NULL values and negation handled in the selection examples?",{"text":118,"@type":110},"It provides queries for selecting rows where a field IS NULL and where a field IS NOT NULL. For negation, it also shows NOT and the use of != as an alternative form.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},572209,1792083786,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":50,"category_name":51,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":101,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":76},962085564381,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","SQL Query – Cheat Sheet  \nAfter completing Master SQL for Data Science ([https://www.udemy.com/master-sql-for-data-science/](https://www.udemy.com/master-sql-for-data-science/)), from Imtiaz Ahmad on Udemy, which I highly recommend, I felt the need to create a cheat sheet for myself so I’ll have the basics to hand when memory fails – which it inevitably does in the beginning…This document does not explain how everything works, it’s literally just quick reminders so do the course first, and then make use of this next!  \nA few general comments to begin:  \n‘Single quotation marks’ are required for most occasions!  \nEach statement is followed by a semi-colon; but if you only have one statement then this is irrelevant.  \nSQL is not a case-sensitive language but by convention commands, functions and keywords appear in upper-case and fields, tables, views, etc. will appear in lower-case.  \nPutting data in  \n\n| SQL Script | Notes |\n| --- | --- |\n| CREATE TABLE table_name ( | Create a new table called table_ name with 2 fields : |\n| field1 varchar(100), | field1 and field2 . The primary key will be the |\n| field2 varchar(100), | unique identifier that is always present . Examples |\n| primary key (field1) | of data types are variable characters, date, |\n| ); | integer, etc . |\n| INSERT INTO table_ name VALUES (‘Cape Town ’,’Western Cape ’);\u003Cbr>INSERT INTO table_ name VALUES (‘Hermanus ’,’Western Cape ’);\u003Cbr>INSERT INTO table_ name VALUES (‘Queenstown ’,’Eastern Cape ’ ); | Add new rows to the table with values as specified |\n\nBasic data selection  \n\n| SQL Script | Notes |\n| --- | --- |\n| SELECT * FROM table_ name ; | Select all fields from the specified table |\n| SELECT firstname, lastname, email\u003Cbr>FROM table_name\u003Cbr>WHERE region = “Western Cape” ; | Select only the fields specified from the table specified where specific criteria are met |\n| * - full wildcard |  |\n| % - partial wildcard, for example:\u003Cbr>SELECT first_name, last_ name, email\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name like ‘%ind%’; | Select first names that contain ‘ind’ with any characters before or after, e .g . Cinderella, Linda, etc . |\n| SELECT *\u003Cbr>FROM employees WHERE 1=1 ; | Twisted logic – it will always bring you all results! |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name = Linda\u003Cbr>AND salary > 500000 ; | Selection with multiple conditions – AND\u003Cbr>Returns all the well-paid Lindas |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name = Linda\u003Cbr>OR salary > 500000 ; | Selection with multiple conditions – OR\u003Cbr>Returns people named Linda or people who earn well |\n\n[www.shotlefttodatascience.com](www.shotlefttodatascience.com)  \n| SQL Script | Notes |\n| --- | --- |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE salary \u003C 500000\u003Cbr>AND (first_name = ' Linda ' OR first_name = 'Carmen ') ; | Combining AND’s and OR’s requires brackets |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name IN (‘Linda’, ‘Carmen’, ‘Julia’ ) ; | With multiple OR’s it is more practical to u se the IN keyword |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE salary BETWEEN 400000 AND 500000 ; | With multiple numeric values we can use ranges rather |\n| SELECT first_name, birth_date\u003Cbr>FROM table_name\u003Cbr>WHERE birth_date BETWEEN ' 1970-01-01' AND ' 1990-01-01’ ; | Notice that with multiple date values single quotation marks are required |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE NOT first_ name = ‘ Linda ;\u003Cbr>-- or otherwise like this\u003Cbr>SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name != ‘Linda ; | Various ways of saying NOT\u003Cbr>Note that comments that are not executable can be preceded with -- , a double-dash |\n| SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE first_ name IS NULL ;\u003Cbr>SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE NOT first_ name IS NULL ; | Special select of null values from a field\u003Cbr>Or selection of non-null values from a field |\n| -- Sort ascending\u003Cbr>SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE NOT first_ name IS NULL\u003Cbr>ORDER BY region ;\u003Cbr>-- Sort descending\u003Cbr>SELECT *\u003Cbr>FROM table_name\u003Cbr>WHERE NOT first_ name I","cbCaigG0lXyh5X6E","https://ap.wps.com/l/cbCaigG0lXyh5X6E","pdf",203019,"English","# SQL Essentials\n## General conventions\n## Table creation and inserts\n## Basic data selection\n## Sorting, distinct, and limiting\n## Formatting and manipulating data","[{\"question\":\"What quoting and statement rules does the cheat sheet recommend for SQL?\",\"answer\":\"Use single quotation marks for most string/date scenarios. Follow each statement with a semicolon; if a statement is alone, the semicolon rule is less relevant.\"},{\"question\":\"How does the cheat sheet explain filtering with WHERE using wildcards and ranges?\",\"answer\":\"It shows % as a partial wildcard (e.g., LIKE '%ind%') and demonstrates BETWEEN for numeric ranges, plus BETWEEN for date ranges using single quotes for date literals.\"},{\"question\":\"How are NULL values and negation handled in the selection examples?\",\"answer\":\"It provides queries for selecting rows where a field IS NULL and where a field IS NOT NULL. For negation, it also shows NOT and the use of != as an alternative form.\"}]","SQL Query - Cheat Sheet | PDF",1791926153]