Mysql show tables command line8/7/2023 ![]() + -+-+ 9 rows in set ( 0.00 sec)Īs you can see, all the tables are the base tables except for the contacts table which is a view.įor the database that has many tables, showing all tables at a time may not be intuitive.įortunately, the SHOW TABLES command provides you with an option that allows you to filter the returned tables using the LIKE operator or an expression in the WHERE clause as follows: SHOW TABLES LIKE pattern įor example, to shows all tables in the classicmodels database that start with the letter p, you use the following statement: > SHOW TABLES LIKE 'p%' Now, you issue the SHOW FULL TABLES command: > SHOW FULL TABLES UNION SELECT contactFirstName, contactLastName, phone CREATE VIEW contactsĪS SELECT lastName, firstName, extension as phone Let’s create a view in the classicmodels database called contacts that includes first name, last name and phone from the employees and customers tables for the demonstration. To include the table type in the result, you use the following form of the SHOW TABLES statement. The SHOW TABLES command allows you to show if a table is a base table or a view. Show tables in the classicmodels database: > show tables Switch to classicmodels database: mysql> use classicmodels ![]() Connect to the MySQL database server: >mysql -u root -pĬode language: SQL (Structured Query Language) ( sql ) ![]() The following example shows you how to list the table in the classicmodels database. The following illustrates the syntax of the MySQL SHOW TABLES command: SHOW TABLES Ĭode language: SQL (Structured Query Language) ( sql ) MySQL SHOW TABLES examples ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |