Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SQL Cheatsheet for MySQL client CLI
create table table_name (
id integer primary key
name varchar(255)
insert into table_name (column1,c2) values ('','') ;
drop user '<user_name>'@'localhost';
update table_name set first_name = value where id = '1';
alter table employees add new_column varchar(255)
alter table employees modify column varchar(255)
select * from employees as e inner join dept_emp as de on e.emp_no = de.emp_no inner join departments as d on d.dept_no = de.dept_no limit 1;
select * from employees order by id desc limit 1;
select *, as userrr from users inner join tasks on tasks.user_id = ;
select * from employees where age between (20,49)
-- a virtual table based on the result of an sql query
create view virtual_emp as select * from employees;
-- Creating and droping indexes
-- Creating prodecures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment