- Insert into table(column1, column2) values(‘value1’,’value2’); – Inserts records into Table. TEXT type values need single quotation marks ‘ ‘.
- Select * from table; – Selects ALL records from table and displays ALL columns
- Select * from table order by column; – Selects all records, shows all columns and then orders by column.
- Select * from table order by column desc – Changes ordering to be depending.
- Select * from table where column = ‘x’; – Shows records where the value in column equals what is requested. For number values you can use = <> conditions and more.
- Select column1,column2 from table; – Only displays data from specified columns
- Select column1, column2 from table where column = ‘x’ order by column; – Shows specific columns where ‘x’ is true and is ordered by a column.
Setup MySQL Lab:
show databases; create database classDB; use classDB; Create table users( user_id INT Auto_INCREMENT PRIMARY KEY, name TEXT, age INT, gender TEXT ); show tables; desc users;