This does not contain a common SQL Query, maybe I will add it in the future. it still just contains any command that is commonly used via terminal
/console
.
Table of contents:
- Add Column to table
- Change the name of the attribute and its type.
- Create a table
- Delete a database
- Delete a table
- Delete an attribute / column
- Login to enter MySQL System
- Show Databases
- Show Tables
- Update table entity / row value
- Using a Database to start to create and run queries
- View the structure of a table
ALTER TABLE items ADD COLUMN stock INT;
add stock
column to items
table
ALTER TABLE items CHANGE COLUMN price cost INT;
change on the items
table attribute named price
to cost
as INT.
mysql> CREATE TABLE users (`id` int auto_increment, `name` text, primary key (id));
code above is an example to create a users
table, and then inside ()
is a table structure.
DROP DATABASE database_name;
remove a database.
DROP TABLE table_name;
remove a table.
ALTER TABLE items DROP COLUMN category;
delete category
column from the items
table.
mysql --user=root --password
--user=root
can be anything based on your system configured
after that.
mysql> SHOW databases;
show the databases created in the system.
mysql> SHOW tables;
show all tables inside a database.
UPDATE users SET username='ryumada' WHERE username='rizukiRyumada';
update username to ryumada
, into a user that has username rizukiRyumada
USE table_name;
Change table_name
with the table name you want to change.
DESCRIBE users;
describe the structure of the users
table.