![]() ![]() ![]() įilter group using the HAVING clause: SELECT select_list FROM table_name GROUP BY column1 HAVING condition Modifying data in tables SELECT select_list FROM table_name GROUP BY column_1, column_2. Sorting a result set: SELECT select_list FROM table_name ORDER BY column1 ASC, column2 ASC Make a Cartesian product of rows: SELECT select_list FROM table1 CROSS JOIN table2 Ĭounting rows in a table. Query data from multiple tables using right join: SELECT select_list FROM table1 RIGHT JOIN table2 ON condition Query data from multiple tables using left join: SELECT select_list FROM table1 LEFT JOIN table2 ON condition Query data from multiple tables using inner join: SELECT select_list FROM table1 INNER JOIN table2 ON condition Query data with a filter using a WHERE clause: SELECT select_list FROM table_name WHERE condition Remove duplicate rows from the result of a query: SELECT DISTINCT ( column) FROM table_name Query data from one or more column of a table: SELECT column1, column2. Query all data from a table: SELECT * FROM table_name Show the information of a column in a table: DESCRIBE table_name column_name Querying data from tables Show the columns of a table: DESCRIBE table_name Remove the primary key of a table: ALTER TABLE table_name DROP PRIMARY KEY ĭrop a table: DROP TABLE table_name ) Īdd primary key into a table: ALTER TABLE table_name ADD PRIMARY KEY (column_name.) SHOW TABLES Ĭreate a new table CREATE TABLE table_name( column_list ) Īdd a new column into a table: ALTER TABLE table ADD column_name ĭrop a column from a table: ALTER TABLE table_name DROP column_name Īdd index with a specific name to a table on a column: ALTER TABLE table ADD INDEX ( column. Show all available databases in the current MySQL database server SHOW DATABASE Working with tables All physical files associated with the database will be deleted. Use a database or change the current database to another database that you are working with: USE database_name ĭrop a database with a specified name permanently. Working with databasesĬreate a database with a specified name if it does not exist in the database server CREATE DATABASE database_name There is no command on Windows OS for clearing MySQL screen console window. To clear MySQL screen console window on Linux, you use the following command: mysql> system clear MySQL command-line client CommandsĬonnect to database using a specified username and password: mysql -u -p While I was coding a SaaS, I got myself thinking if there was a quick way to memorize Mysql commands just like I do with games like GT5, well here is a snippet of what I found at a pretty cool website by the way. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |