view table mysql code example
Example 1: print all records of table in mysql
SELECT * FROM TABLE_NAME;
OR
SELECT column_name_1, column_name_2 FROM TABLE_NAME;
Example 2: mysql command show tables
SHOW TABLES;
Example 3: create view mysql
CREATE VIEW `general_v_movie_rentals` AS SELECT mb.`membership_number`,mb.`full_names`,mo.`title`,mr.`transaction_date`,mr.`return_date` FROM `movierentals` AS mr INNER JOIN `members` AS mb ON mr.`membership_number` = mb.`membership_number` INNER JOIN `movies` AS mo ON mr.`movie_id` = mo.`movie_id`;
Example 4: create view
CREATE VIEW view_name AS SELECT id,category,MAX(created_at),content,title FROM table WHERE condition GROUP BY category
Example 5: mysql command show tables
mysql -u user -p
Example 6: show tables mysql
Press CTRL+C to copy SHOW [EXTENDED] [FULL] TABLES
[{FROM | IN} db_name]
[LIKE 'pattern' | WHERE expr]