

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


#creates server CREATE TABLE table_name ( column INT AUTO_INCREMENT PRIMARY KEY. row1 VARCHAR(int), row2 INT, FOREIGN KEY (column) REFERENCES table_name(column) ); #creates table SELECT row FROM table_name WHERE column = "int" #shows the selected values DELETE FROM table_name WHERE column = 'int' #deletes row UPDATE TABLE_NAME SET row = "info", row = "info", where column = "info"; INSERT INTO table_name #(column_name, var)# VALUES ('info', 'info'); ALTER TABLE table_name ADD column_name VARCHAR(int);
UPDATE table_name SET row = 'value' WHERE column = int; UPDATE table_name SET row = 'value' WHERE column IN (int,int,int); SELECT first_name, last_name FROM company_employees WHERE status = 'Active' AND salary > 10000; SELECT first_name, last_name FROM company_employees WHERE status = 'Active' OR department = 'IT'; SELECT * FROM company_employees LIMIT 5; #shows the first 5 items SELECT MIN(salary) FROM company_employees; #shows the min salary SELECT MIN(salary) as sahod FROM company_employees; #changes the column name SELECT MAX(salary) as highest_salary FROM company_employees; #reflects the highest amount SELECT MIN(salary) as smallest_salary, MAX(salary) as highest_salary FROM company_employees; #shows both SELECT count(employee_id) as count FROM company_employees WHERE status = 'Resigned'; #shows count SELECT AVG(salary) FROM company_employees WHERE department IN('HR','IT') AND status = "Active";