SQL Cheatsheet for MySQL client CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 *, users.id as userrr from users inner join tasks on tasks.user_id = users.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