[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571368-105":53,"doc-detail-571368-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-quick-reference-queries-joins-tables-and-everyday-operations","SQL - Quick Reference - Queries, Joins, Tables, and Everyday Operations","","Quick Reference / SQL provides concise example-driven guidance for finding, filtering, sorting, and combining data. It covers SELECT patterns with WHERE conditions, LIKE matching, grouping and HAVING logic, and practical handling of NULL values using IS NULL and COALESCE. It also explains common join types (INNER and LEFT), subqueries with EXISTS, and everyday operations such as creating tables, inserting, updating, deleting, adding constraints, indexes, transactions, CTEs, CASE expressions, and safe parameter binding.",{"@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":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/sql-quick-reference-queries-joins-tables-and-everyday-operations/571368/",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-quick-reference-queries-joins-tables-and-everyday-operations/571368.png","ImageObject",442,249,{"name":88,"@type":89},"miaandmiso","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-22","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",6,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you filter results in SQL using WHERE, AND/OR, and range conditions?","Question",{"text":109,"@type":110},"Use WHERE to restrict rows, combining predicates with AND, OR, and NOT. Apply comparisons like >, >=, and BETWEEN x AND y for inclusive ranges, and use parentheses to control precedence.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What is the difference between INNER JOIN and LEFT JOIN?",{"text":114,"@type":110},"INNER JOIN returns matching rows from both tables. LEFT JOIN keeps every left-side row, and unmatched right-side columns are returned as NULL.",{"name":116,"@type":107,"acceptedAnswer":117},"How should NULL values be handled safely in SQL queries?",{"text":118,"@type":110},"Use IS NULL or IS NOT NULL rather than = NULL. For fallback display values, use COALESCE to return the first non-NULL argument.","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},571368,1792359688,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"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":73,"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":9},7971478544854,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","QUICK REFERENCE / SQL  \nSQL Find, filter, and combine your data.  \n  DevSheets  \n01 / QUERIES & JOINS  \n 01  Read rows with SELECT  \nSELECT id, name, city FROM users  \nWHERE active = TRUE;  \nExamples use the users and orders tables on page 2. Keywords are conventionally uppercase; semicolons end statements.  \nCommon SQL is shared, but types, functions, and parameter syntax vary by database. LIMIT examples fit PostgreSQL, MySQL, and SQLite.  \n 02  Filter conditions  \n\n| = / \u003C> | Equal / not equal |\n| --- | --- |\n| > / >= | Greater / at least |\n| AND / OR / NOT | Combine conditions |\n| IN (1, 2) | Match a listed value |\n| BETWEEN 1 AND 5 | Inclusive range |\n| LIKE 'A%' | Starts with A |\n\nLIKE uses % for any sequence and _ for one character. Case sensitivity depends on the database and collation. Group AND/OR with parentheses.  \n 03  Sort & limit results  \nSELECT id, name  \nFROM users  \nORDER BY name ASC , id ASC LIMIT 10 OFFSET 20 ;  \nASC is ascending; DESC is descending. This skips 20 rows and returns up to 10. Use a unique tie-breaker for a stable order.  \n 04  NULL & fallback values  \nSELECT name,  \nCOALESCE(city, 'Unknown' ) AS city FROM users  \nWHERE email IS NULL;  \nNULL means missing or unknown. Use IS NULL or IS NOT NULL, not = NULL. COALESCE returns the first non-NULL argument.  \n 05  Aggregate functions  \nSELECT COUNT(*) AS orders, COUNT(user_id) AS linked_orders,  \nFROM  \nSUM(total) AS AVG(total) AS MIN(total) AS  \nMAX(total) AS orders;  \nrevenue, average_total, smallest, largest  \nCOUNT(*) counts rows. COUNT(column) and most other aggregates ignore NULL inputs. SUM on no rows returns NULL; COUNT returns 0.  \n 06  GROUP BY & HAVING  \nSELECT user_id, COUNT(*) AS orders FROM orders  \nWHERE total >= 10  \nGROUP BY user_id  \nHAVING COUNT(*) >= 2  \nORDER BY orders DESC , user_id;  \nWHERE filters rows before grouping; HAVING filters groups afterward. Group selected non-aggregate columns. DISTINCT removes duplicate result rows.  \n 07  INNER JOIN  \nSELECT [u.name](u.name) , [o.id](o.id) , [o.total](o.total)[ ](o.total)FROM users AS u  \nINNER JOIN orders AS o ON o .user_id = [u.id](u.id) ;  \nReturns matching pairs from both tables. One user can appear many times when they have several orders. Aliases shorten qualified column names.  \n 08  LEFT JOIN  \nSELECT [u.name](u.name) , [o.id](o.id)[ ](o.id)FROM users AS u  \nLEFT JOIN orders AS o  \nON o .user_id = u .id AND [o.total](o.total) >= 50;  \nKeeps every user, even without a matching order. Unmatched right-side columns are NULL. A right-side WHERE filter can remove those unmatched rows.  \n 09  Subqueries & EXISTS  \nSELECT [u.id](u.id) , [u.name](u.name)[ ](u.name)FROM users AS u WHERE EXISTS (  \nSELECT 1 FROM orders AS o  \nWHERE o .user_id = u .id );  \nEXISTS tests whether a subquery returns any row. This finds users with orders without duplicating users. NOT EXISTS finds users without orders.  \nQUICK REFERENCE / SQL  \nSQL Define tablesand change data carefully.  \n  DevSheets  \n02 / TABLES & EVERYDAY OPERATIONS  \n 10  Create a table  \nCREATE TABLE users ( id INTEGER PRIMARY KEY , name VARCHAR (80) NOT NULL , email VARCHAR (200) UNIQUE , city VARCHAR (80),  \nactive BOOLEAN NOT NULL DEFAULT TRUE );  \nPRIMARY KEY identifies rows; NOT NULL requires a value; UNIQUE prevents duplicates. ID generation and type enforcement differ by engine.  \n 11  INSERT rows  \nINSERT INTO users  \n(id, name, email, city)  \nVALUES  \n(1, 'Maya', '[maya@example.com](maya@example.com) ', 'Boston'),(2 , 'Leo' , NULL , NULL);  \nList the target columns explicitly. Omitted columns use their defaults or NULL if allowed. Strings use single quotes; escape an apostrophe as two quotes.  \n 12  UPDATE & DELETE  \nUPDATE users  \nSET city = 'Chicago'WHERE id = 1 ;  \nDELETE FROM orders WHERE id = 99 ;  \nWHERE limits affected rows. Without it, UPDATE or DELETE targets every row. Preview the same condition with SELECT and use a transaction when appropriate.  \n 13  Relationships & constraints  \nCREATE TABLE orders ( id INTEGE","cbCaio64rwk4fcFx","https://ap.wps.com/l/cbCaio64rwk4fcFx","pdf",79855,"English","# Queries & Joins\n## Read rows with SELECT\n## Filter conditions\n## Sort & limit results\n## NULL & fallback values\n## Aggregate functions\n## GROUP BY & HAVING\n## INNER JOIN\n## LEFT JOIN\n## Subqueries & EXISTS\n# Tables & Everyday Operations\n## Create a table\n## INSERT rows\n## UPDATE & DELETE\n## Relationships & constraints\n## Indexes\n## Transactions\n## Common table expressions\n## Conditional values with CASE\n## Bind values as parameters","[{\"question\":\"How do you filter results in SQL using WHERE, AND/OR, and range conditions?\",\"answer\":\"Use WHERE to restrict rows, combining predicates with AND, OR, and NOT. Apply comparisons like \\u003e, \\u003e=, and BETWEEN x AND y for inclusive ranges, and use parentheses to control precedence.\"},{\"question\":\"What is the difference between INNER JOIN and LEFT JOIN?\",\"answer\":\"INNER JOIN returns matching rows from both tables. LEFT JOIN keeps every left-side row, and unmatched right-side columns are returned as NULL.\"},{\"question\":\"How should NULL values be handled safely in SQL queries?\",\"answer\":\"Use IS NULL or IS NOT NULL rather than = NULL. For fallback display values, use COALESCE to return the first non-NULL argument.\"}]","SQL - Quick Reference - Queries, Joins, Tables, and Everyday Operations | PDF",1791914377]