100 MySQL commands

100 MySQL commands

 Sure! Here are 100 MySQL commands that you can use for interacting with a MySQL database:


1. CREATE DATABASE - Create a new database.

2. USE - Select a database to work with.

3. CREATE TABLE - Create a new table.

4. ALTER TABLE - Modify an existing table structure.

5. DROP TABLE - Delete a table.

6. SHOW TABLES - List all tables in a database.

7. DESCRIBE - Display the structure of a table.

8. INSERT INTO - Insert data into a table.

9. SELECT - Retrieve data from one or more tables.

10. UPDATE - Modify existing data in a table.

11. DELETE - Delete data from a table.

12. TRUNCATE TABLE - Remove all data from a table.

13. DISTINCT - Retrieve unique values from a column.

14. ORDER BY - Sort the result set.

15. GROUP BY - Group rows based on a column.

16. HAVING - Filter groups in a GROUP BY query.

17. LIMIT - Limit the number of rows in the result set.

18. JOIN - Combine rows from multiple tables based on a related column.

19. INNER JOIN - Return rows that have matching values in both tables.

20. LEFT JOIN - Return all rows from the left table and matching rows from the right table.

21. RIGHT JOIN - Return all rows from the right table and matching rows from the left table.

22. FULL OUTER JOIN - Return all rows when there is a match in either the left or right table.

23. UNION - Combine the result sets of two or more SELECT statements.

24. UNION ALL - Combine the result sets of two or more SELECT statements (including duplicates).

25. LIKE - Pattern matching using wildcards.

26. IN - Specify multiple possible values for a column.

27. BETWEEN - Specify a range of values.

28. IS NULL - Check for NULL values.

29. EXISTS - Check for the existence of rows in a subquery.

30. NOT - Negate a condition.

31. AVG - Calculate the average value of a column.

32. SUM - Calculate the sum of a column.

33. MIN - Find the minimum value in a column.

34. MAX - Find the maximum value in a column.

35. COUNT - Count the number of rows in a table or the number of occurrences of a value in a column.

36. GROUP_CONCAT - Concatenate values from multiple rows into a single string.

37. CONCAT - Concatenate multiple strings.

38. LENGTH - Get the length of a string.

39. SUBSTRING - Extract a substring from a string.

40. DATE - Extract the date part from a datetime or timestamp value.

41. CURDATE - Get the current date.

42. CURTIME - Get the current time.

43. NOW - Get the current date and time.

44. DATE_FORMAT - Format a date or time value.

45. DATEDIFF - Calculate the difference between two dates.

46. CASE - Perform conditional logic in a query.

47. IF - Perform conditional logic in a query.

48. RAND - Generate a random number.

49. ROUND - Round a numeric value to a specified number of decimal places.

50. COALESCE - Return the first non-null value in a list.

51. CAST - Convert a value from one data type to another.

52. INDEX - Create an index on a table column.

53. UNIQUE - Specify that a column must have unique values.

54. PRIMARY KEY - Define a primary key for a table.

55. FOREIGN KEY - Define a foreign key constraint.

56. CONSTRAINT - Define a constraint on a table.

57. ALTER TABLE - Add, modify, or drop table columns.

58. GRANT - Grant privileges to a user account.

59. REVOKE - Revoke privileges from a user account.

60. FLUSH PRIVILEGES - Reload the privileges from the grant tables.

61. SHOW GRANTS - Show the privileges granted to a user.

62. CREATE USER - Create a new user account.

63. DROP USER - Delete a user account.

64. SET PASSWORD - Set or change the password for a user account.

65. SHOW DATABASES - List all databases on the server.

66. SHOW VARIABLES - Show the values of MySQL system variables.

67. SHOW STATUS - Show server status information.

68. SHOW PROCESSLIST - Show a list of active database connections.

69. COMMIT - Commit a transaction.

70. ROLLBACK - Roll back a transaction.

71. SAVEPOINT - Set a savepoint within a transaction.

72. BEGIN - Begin a transaction.

73. LOCK TABLES - Lock tables for a specific operation.

74. UNLOCK TABLES - Release table locks.

75. CREATE VIEW - Create a virtual table based on the result of a query.

76. DROP VIEW - Delete a view.

77. CREATE INDEX - Create an index on a table column.

78. DROP INDEX - Delete an index from a table.

79. SHOW INDEX - Show information about indexes on a table.

80. SHOW CREATE TABLE - Show the SQL statement used to create a specific table.

81. SHOW CREATE VIEW - Show the SQL statement used to create a specific view.

82. SHOW TRIGGERS - Show information about triggers in a database.

83. CREATE TRIGGER - Create a new trigger.

84. DROP TRIGGER - Delete a trigger.

85. SHOW EVENTS - Show information about events (scheduled tasks) in a database.

86. CREATE EVENT - Create a new event (scheduled task).

87. ALTER EVENT - Modify an existing event.

88. DROP EVENT - Delete an event.

89. SET - Set the value of a system variable.

90. SHOW WARNINGS - Show the last warning message.

91. SHOW ERRORS - Show the last error message.

92. SHOW ENGINE - Show information about storage engines.

93. EXPLAIN - Explain how the MySQL optimizer executes a query.

94. OPTIMIZE TABLE - Reorganize the physical storage of a table.

95. ANALYZE TABLE - Analyze table statistics for query optimization.

96. LOCK - Lock a table explicitly.

97. UNLOCK - Release a table lock.

98. SET AUTOCOMMIT - Enable or disable auto-commit mode.

99. SHOW FULL PROCESSLIST - Show a full list of active database connections.

100. SHOW TABLE STATUS - Show information about tables in a database.


These are just some of the commonly used MySQL commands. The MySQL documentation provides a comprehensive list of commands and their usage.

Reactions

Post a Comment

0 Comments

close