[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-572799-105":53,"doc-detail-572799-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","mysql-cheat-sheet-quick-reference-for-sql-commands","MySQL Cheat Sheet - Quick Reference for SQL Commands","","MySQL Cheat Sheet provides practical, command-focused guidance for working with the MySQL server and common SQL tasks. It covers connecting to the server, creating and listing databases, defining tables (including foreign keys), and altering table structures. The sheet also explains querying data with SELECT, joins, and grouping, plus aggregation functions. Additional sections address inserting, updating, deleting, casting, and both text, numeric, and date/time functions.",{"@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/mysql-cheat-sheet-quick-reference-for-sql-commands/572799/",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/mysql-cheat-sheet-quick-reference-for-sql-commands/572799.png","ImageObject",442,249,{"name":88,"@type":89},"SundayMiles","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},"How do you connect to a MySQL server using the command-line client?","Question",{"text":109,"@type":110},"Use the mysql client with a username and prompt for the password, e.g., mysql -u [username] -p. To connect to a specific database, use mysql -u [username] -p [database].","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How do you create tables and set up an AUTO_INCREMENT primary key?",{"text":114,"@type":110},"Use CREATE TABLE with an AUTO_INCREMENT column defined as a primary or unique key, e.g., id INT PRIMARY KEY AUTO_INCREMENT. The cheat sheet also shows creating tables with foreign keys using FOREIGN KEY(...) REFERENCES ... .",{"name":116,"@type":107,"acceptedAnswer":117},"How do you run a basic query with filtering, grouping, and sorting?",{"text":118,"@type":110},"Use SELECT with WHERE for filtering, GROUP BY for grouping, HAVING for group-level conditions, and ORDER BY for sorting. The sheet provides an example using AVG(age), GROUP BY species, and ORDER BY AVG(age) DESC.","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},572799,1792083832,{"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":35,"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":141},1099529839202,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","MySQL Cheat Sheet   \nMySQL is a popular open-source relational database management system known for its ease of use and scalability. Sometimes, you will need a little help while working on a project. That's why we created this MySQL Cheat Sheet.  \nInstructions for installing MySQL are available at: [https://dev. mysql.com](https://dev. mysql.com)  \nCONTENTS  \nCONNECTING TOA MYSQL SERVER 2  \nCREATING AND DISPLAYING DATABASES 2  \nCREATING TABLES 3  \nMODIFYING TABLES 4  \nQUERYING DATA 5  \nAGGREGATION AND GROUPING 6  \nINSERTING, UPDATING & DELETING DATA 7  \nCASTING 8  \nTEXT FUNCTIONS 9  \nNUMERIC FUNCTIONS 11  \nNULL FUNCTIONS 12  \nDATE AND TIME 13  \nINTERVALS 13  \nWHAT TIME IS IT? 14  \nCREATING TIME VALUES 14  \nEXTRACTING PARTS OF DATES 15  \nDATE ARITHMETICS 15  \nThis Cheat Sheet was prepared by LearnSQL.com as a part of its SQL training program. Check out other SQL Cheat Sheets.  \nLearnSQL.com is owned [by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA](by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA)  \nMySQL Cheat Sheet   \nCONNECTING TOA MYSQL SERVER  \nConnect to a MySQL server with a username and a password using the mysql command-line client.  \nMySQL will prompt for the password: mysql -u [username] -p  \nTo connect to a specific database on a MySQL server using a username anda password:  \nmysql -u [username] -p [database] To export data using the mysqldump tool:  \nmysqldump -u [username] -p \\[database] > data_backup.sql  \nTo exit the client: quit or exit  \nFor a full list of commands:  \nhelp  \nCREATING AND DISPLAYING  \nDATABASES  \nTo create a database:  \nCREATE DATABASE zoo;  \nTo list all the databases on the server:  \nSHOW DATABASES;  \nTo use a specified database:  \nUSE zoo;  \nTo delete a specified database:  \nDROP DATABASE zoo;  \nTo list all tables in the database:  \nSHOW TABLES;  \nTo get information about a specified table:  \nDESCRIBE animal;  \nIt outputs column names, data types, default values, and more about the table.  \nThis Cheat Sheet was prepared by LearnSQL.com as a part of its SQL training program. Check out other SQL Cheat Sheets.  \nLearnSQL.com is owned [by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA](by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA)  \nMySQL Cheat Sheet   \nCREATING TABLES  \nTo create a table:  \nCREATE TABLE habitat ( id INT ,  \nname VARCHAR (64)  \n) ;  \nUse AUTO_INCREMENT to increment the ID automatically with each new record. An AUTO_INCREMENT column must be defined as a primary or unique key:  \nCREATE TABLE habitat (  \nid INT PRIMARY KEY AUTO_INCREMENT , name VARCHAR (64)  \n) ;  \nTo create a table with a foreign key: CREATE TABLE animal (  \nid INT PRIMARY KEY AUTO_INCREMENT ,  \nname VARCHAR (64) , species VARCHAR (64) , age INT , habitat_id INT ,  \nFOREIGN KEY (habitat_id) REFERENCES habitat (id)  \n) ;  \nThis Cheat Sheet was prepared by LearnSQL.com as a part of its SQL training program. Check out other SQL Cheat Sheets.  \nLearnSQL.com is owned [by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA](by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA)  \nMySQL Cheat Sheet   \nMODIFYING TABLES  \nUse the ALTER TABLE statement to modify the table structure.  \nTo change a table name:  \nALTER TABLE animal RENAME pet;  \nTo add a column to the table: ALTER TABLE animal  \nADD COLUMN name VARCHAR (64) ;  \nTo change a column name: ALTER TABLE animal  \nRENAME COLUMN id TO identifier;  \nTo change a column data type: ALTER TABLE animal  \nMODIFY COLUMN name VARCHAR ( 128) ;  \nTo delete a column: ALTER TABLE animal DROP COLUMN name;  \nTo delete a table:  \nDROP TABLE animal;  \nThis Cheat Sheet was prepared by LearnSQL.com as a part of its SQL training program. Check out other SQL Cheat Sheets.  \nLearnSQL.com is owned [by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA](by Vertabelo SA | vertabelo.com | CC BY-NC-ND Vertabelo SA)  \nMySQL Cheat Sheet   \nQUERYING DATA  \nTo select data from a table, use the SELECT command.  \nAn example of a single-table que","cbCaiqu2Jz7TJ3gx","https://ap.wps.com/l/cbCaiqu2Jz7TJ3gx","pdf",493782,"English","# CONTENTS\n## CONNECTING TO A MYSQL SERVER\n## CREATING AND DISPLAYING DATABASES\n## CREATING TABLES\n## MODIFYING TABLES\n## QUERYING DATA\n## AGGREGATION AND GROUPING\n## INSERTING, UPDATING & DELETING DATA\n## CASTING\n## TEXT FUNCTIONS\n## NUMERIC FUNCTIONS\n## NULL FUNCTIONS\n## DATE AND TIME\n## INTERVALS\n## WHAT TIME IS IT?\n## CREATING TIME VALUES\n## EXTRACTING PARTS OF DATES\n## DATE ARITHMETICS","[{\"question\":\"How do you connect to a MySQL server using the command-line client?\",\"answer\":\"Use the mysql client with a username and prompt for the password, e.g., mysql -u [username] -p. To connect to a specific database, use mysql -u [username] -p [database].\"},{\"question\":\"How do you create tables and set up an AUTO_INCREMENT primary key?\",\"answer\":\"Use CREATE TABLE with an AUTO_INCREMENT column defined as a primary or unique key, e.g., id INT PRIMARY KEY AUTO_INCREMENT. The cheat sheet also shows creating tables with foreign keys using FOREIGN KEY(...) REFERENCES ... .\"},{\"question\":\"How do you run a basic query with filtering, grouping, and sorting?\",\"answer\":\"Use SELECT with WHERE for filtering, GROUP BY for grouping, HAVING for group-level conditions, and ORDER BY for sorting. The sheet provides an example using AVG(age), GROUP BY species, and ORDER BY AVG(age) DESC.\"}]","MySQL Cheat Sheet - Quick Reference for SQL Commands | PDF",1791929307,6]