Use a database: To start using a particular database, you can use the USE statement.Show all databases: To see a list of all existing databases, you can use the SHOW DATABASES statement. ![]() Create a database: You can use the CREATE DATABASE statement to create a new database in MySQL.To work with databases in MySQL, you can perform the following common operations: These commands can be executed directly in the MySQL command-line client by typing them and pressing enter. EXIT: closes the MySQL command-line client.REVOKE: removes privileges from a user to access the database.GRANT: gives privileges to a user to access the database.ROLLBACK: discards changes made to the database.COMMIT: saves changes made to the database.DESCRIBE: displays information about the columns in a table.SHOW: displays information about databases, tables, and other database objects.DROP: removes a database, table, or other database object.ALTER: modifies the structure of a table or other database object.CREATE: creates databases, tables, and other database objects.UPDATE: modifies existing rows in a table.SELECT: retrieves data from one or more tables.Some of the most commonly used MySQL command-line client commands include: The MySQL command-line client provides several commands that can be used to interact with the database. FULL OUTER JOIN – returns all rows from both tables, with unmatched rows appearing as NULL values.RIGHT JOIN – returns all rows from the right table and matching rows from the left table.LEFT JOIN – returns all rows from the left table and matching rows from the right table.INNER JOIN – returns only rows where there is a matching value in both tables.LIKE – performs pattern matching in a query.MAX – retrieves the maximum value of a column.MIN – retrieves the minimum value of a column.COUNT – counts the number of rows in a table.AVG – calculates the average of a set of values.SUM – calculates the sum of a set of values.ORDER BY – sorts the data in ascending or descending order.LIMIT – limits the number of records retrieved. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |