[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571366-105":53,"doc-detail-571366-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-basics-cheat-sheet-quick-reference","SQL Basics Cheat Sheet - Quick Reference","","SQL Basics Cheat Sheet provides a fast, structured overview of Structured Query Language for working with relational databases. It covers selecting fields from single tables, sorting results with ORDER BY in both ASC and DESC directions, using aliases, and filtering output with comparison, text pattern, and set operators. It also explains how to combine tables through INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, and NATURAL JOIN, including brief guidance for join matching and NULL behavior.",{"@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-basics-cheat-sheet-quick-reference/571366/",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-basics-cheat-sheet-quick-reference/571366.png","ImageObject",442,249,{"name":88,"@type":89},"Guten Appetit_Joghurt","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",7,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you fetch all columns or only specific columns from a table?","Question",{"text":109,"@type":110},"Use SELECT * FROM \u003Ctable>; to fetch all columns. Use SELECT \u003Ccol1>, \u003Ccol2> FROM \u003Ctable>; to fetch only selected columns.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How can you sort results by a column in ascending or descending order?",{"text":114,"@type":110},"Use ORDER BY \u003Ccolumn> [ASC]; for ascending order and ORDER BY \u003Ccolumn> DESC; for descending order.",{"name":116,"@type":107,"acceptedAnswer":117},"What are the differences between INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, and CROSS JOIN?",{"text":118,"@type":110},"INNER JOIN returns only matching rows. LEFT JOIN keeps all rows from the left table and fills non-matches with NULL. RIGHT JOIN keeps all rows from the right table and fills non-matches with NULL. FULL JOIN returns all rows from both tables with NULLs for missing matches. CROSS JOIN returns all possible row combinations.","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},571366,1792128204,{"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},1374408768420,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","SQL Basics Cheat Sheet   \nSQL, or Structured Query Language, is a language to talk to databases. It allows you to select specific data and to build complex reports. Today, SQL is a universal language of data. It is used in practically all technologies that process data.  \nSAMPLE DATA  \n\n| COUNTRY |  |  |  |  |  |  |  |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| id |  | name |  | population |  | area |  |\n| 1 |  | France |  | 66600000 |  | 640680 |  |\n| 2 |  | Germany |  | 80700000 |  | 357000 |  |\n| . . . |  | . . . |  | . . . |  | . . . |  |\n| CITY |  |  |  |  |  |  |  |\n| id | name |  | country_id |  | population |  | rating |\n| 1 | Paris |  | 1 |  | 2243000 |  | 5 |\n| 2 | Berlin |  | 2 |  | 3460000 |  | 3 |\n| . . . | . . . |  | . . . |  | . . . |  | . . . |\n\nQUERYING SINGLE TABLE  \nFetch all columns from the country table: SELECT *  \nFROM country;  \nFetch id and name columns from the city table:  \nSELECT id , name FROM city;  \nFetch city names sorted by the rating column in the default ASCending order:  \nSELECT name FROM city  \nORDER BY rating [ASC];  \nFetch city names sorted by the rating column in the DESCending order:  \nSELECT name FROM city  \nORDER BY rating DESC;  \nALIASES  \nCOLUMNS  \nSELECT name AS city_name FROM city;  \nTABLES  \nSELECT [co.name](co.name) , [ci.name](ci.name)[ ](ci.name)FROM city AS ci  \nJOIN country AS co  \nON [ci.country_id = co.id](ci.country_id = co.id);  \nFILTERING THE OUTPUT COMPARISON OPERATORS  \nFetch names of cities that have a rating above 3: SELECT name  \nFROM city  \nWHERE rating > 3 ;  \nFetch names of cities that are neither Berlin nor Madrid: SELECT name  \nFROM city  \nWHERE name ! = 'Berlin 'AND name ! = 'Madrid ' ;  \nTEXT OPERATORS  \nFetch names of cities that start with a 'P' or end with an 's': SELECT name  \nFROM city  \nWHERE name LIKE 'P% 'OR name LIKE '%s ' ;  \nFetch names of cities that start with any letter followed by 'ublin'(like Dublin in Ireland or Lublin in Poland):  \nSELECT name FROM city  \nWHERE name LIKE '_ublin ' ;  \nOTHER OPERATORS  \nFetch names of cities that have a population between 500K and 5M:  \nSELECT name FROM city  \nWHERE population BETWEEN 500000 AND 5000000;  \nFetch names of cities that don't miss a rating value: SELECT name  \nFROM city  \nWHERE rating IS NOT NULL;  \nFetch names of cities that are in countries with IDs 1, 4, 7, or 8: SELECT name  \nFROM city  \nWHERE country_id IN (1 , 4 , 7 , 8 ) ;  \nQUERYING MULTIPLE TABLES INNER JOIN  \nJOIN (or explicitly INNER JOIN) returns rows that have matching values in both tables.  \nSELECT [city.name](city.name) , [country.name](country.name)[ ](country.name)FROM city  \n[INNER] JOIN country  \nON [city.country_id = country.id](city.country_id = country.id);  \nCITY COUNTRY  \nid name country_id id name  \n\n| 1 | Paris | 1 | 1 | France |\n| --- | --- | --- | --- | --- |\n| 2 | Berlin | 2 | 2 | Germany |\n\n\n| 3 | Warsaw | 4 | 3 | Iceland |\n| --- | --- | --- | --- | --- |\n\nLEFT JOIN  \nLEFT JOIN returns all rows from the leȦ table with corresponding rows from the right table. If there's no matching row, NULLs are returned as values from the second table. SELECT [city.name](city.name) , [country.name](country.name)  \nFROM city  \nLEFT JOIN country  \nON [city.country_id = country.id](city.country_id = country.id);  \nCITY COUNTRY  \nid name country_id id name  \n\n| 1 | Paris | 1 | 1 | France |\n| --- | --- | --- | --- | --- |\n| 2 | Berlin | 2 | 2 | Germany |\n| 3 | Warsaw | 4 | NULL | NULL |\n\nRIGHT JOIN  \nRIGHT JOIN returns all rows from the right table with corresponding rows from the leȦ table. If there's no matching row, NULLs are returned as values from the leȦ table.  \nSELECT [city.name](city.name) , [country.name](country.name)[ ](country.name)FROM city  \nRIGHT JOIN country  \nON [city.country_id = country.id](city.country_id = country.id);  \nCITY COUNTRY  \nid name country_id id name  \n\n| 1 | Paris | 1 | 1 | France |\n| --- | --- | --- | --- | --- |\n| 2 | Berlin | 2 | 2 | Germany |\n| NULL | NULL | NULL | 3 | Iceland |\n\nFULL JOI","cbCaiqG86DLDp51d","https://ap.wps.com/l/cbCaiqG86DLDp51d","pdf",105253,"English","# Query Basics\n## Sample Data\n## Querying Single Table\n## Aliases\n## Filtering the Output\n## Text Operators\n## Other Operators\n# Querying Multiple Tables\n## INNER JOIN\n## LEFT JOIN\n## RIGHT JOIN\n## FULL JOIN\n## CROSS JOIN\n## NATURAL JOIN","[{\"question\":\"How do you fetch all columns or only specific columns from a table?\",\"answer\":\"Use SELECT * FROM \\u003ctable\\u003e; to fetch all columns. Use SELECT \\u003ccol1\\u003e, \\u003ccol2\\u003e FROM \\u003ctable\\u003e; to fetch only selected columns.\"},{\"question\":\"How can you sort results by a column in ascending or descending order?\",\"answer\":\"Use ORDER BY \\u003ccolumn\\u003e [ASC]; for ascending order and ORDER BY \\u003ccolumn\\u003e DESC; for descending order.\"},{\"question\":\"What are the differences between INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, and CROSS JOIN?\",\"answer\":\"INNER JOIN returns only matching rows. LEFT JOIN keeps all rows from the left table and fills non-matches with NULL. RIGHT JOIN keeps all rows from the right table and fills non-matches with NULL. FULL JOIN returns all rows from both tables with NULLs for missing matches. CROSS JOIN returns all possible row combinations.\"}]","SQL Basics Cheat Sheet - Quick Reference | PDF",1791914370]