Presentation on theme: "Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries."— Presentation transcript:
What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries on databases.
Some basic commands SELECT * FROM table1 What do you think it will do? The * means everything so, select everything from table 1. easy! SELECT Name, ID, Colour FROM table1 You can select specific columns to show. SELECT Name, ID, Colour FROM table1 WHERE ID<10 The WHERE clause adds an additional parameter for SQL to run through to select only data “WHERE” ID is less than (<)10.
Adding data INSERT INTO table1 (Name, ID, Colour) VALUES (Jim, 10, ) Will insert VALUES into table1 in the order stated (Name, ID, Colour) The missing “Colour” means that NULL will be entered.
Editing UPDATE table1 SET Colour= Green WHERE Name= Jim This will “UPDATE” records “WHERE” Name= Jim to show Colour as Green. If more than one record has Name as Jim then these will also be updated. Using * also means that every record will be updated.