MySQL: How to select and change database and show tables in mysql
To login : mysql -uusername -ppassword
Show databases: show databases;
show tables: show tables;
To see which database you are using currently : select database() from dual
Show all databases: show databases;
Access database: mysql -u [username] -p [database] (will prompt for password)
Create new database: create database [database];
Select database: use [database];
Determine what database is in use: select database();
Show all tables: show tables;
Show table structure: describe [table];
List all indexes on a table: show index from [table];
Create new table with columns: CREATE TABLE [table] ([column] VARCHAR(120), [another-column] DATETIME);
Adding a column: ALTER TABLE [table] ADD COLUMN [column] VARCHAR(120);
Adding a column with an unique, auto-incrementing ID: ALTER TABLE [table] ADD COLUMN [column] int NOT NULL AUTO_INCREMENT PRIMARY KEY;
Inserting a record: INSERT INTO [table] ([column], [column]) VALUES (‘[value]’, [value]’);
MySQL function for datetime input: NOW()
Selecting records: SELECT * FROM [table];
Explain records: EXPLAIN SELECT * FROM [table];
Selecting parts of records: SELECT [column], [another-column] FROM [table];
Counting records: SELECT COUNT([column]) FROM [table];
My website:
Nguồn: https://saesrpg.net/
Xem thêm bài viết khác: https://saesrpg.net/giai-tri/
Xem thêm Bài Viết:
- TRÒ CHƠI "XOẮN NÃO" DỄ QUẠO NHẤT VỤ TRỤ | Nabee TV
- Conversation with foreigners in English | Learn English for all levels
- Cố Chấp – Về Nơi Đâu (Phần 1) – TraCy Thảo My [ Official Music Video ]
- Học trực tuyến trên truyền hình MyTV: Giải pháp tối ưu mùa Covid-19
- Hướng dẫn sử dụng tính năng Điều khiển tivi (Remote Controller) trên MyTV và MyTV Net