Simple SQL query for Suzy

This post is for Suzy and her interest in SQL. This stands for Structured Query Language. It’s just data in tables so it’s really pretty simple.

SQL is just tables. Rows and columns. We can create logical statements to call data from these tables. Basics will be be SELECT, INSERT, UPDATE, and DELETE.

With SELECT we will fetch data from the the table specified. INSERT inserts new data and UPDATE will update existing data in the table. DELETE does pretty much that.

We just need to know the syntax. Something like this:

SELECT field1 FROM table_name1

We select the field(s) we want from the table we want. This is a query and tells whatever is connect to the SQL tables to look for field1 and look in table_name1.

We also can use WHERE to create some conditions to be satisfied by the query.

SELECT field1 FROM table_name1
WHERE ID=’789′

This will only return the field one from table_name1 if there is an id the = 789.

These are super basic SQL and these can get complicated depending on the data you attempting to retrieve. There are different kinds of SQL, but they have logical query fun like this. You can submit a query directly to the SQL table if you have access or a programing language can do this for you and do something programmatically based on the response. Said programing will require credentials to access the SQL. Again this post is brief and there is much more to learn about using SQL and the various incarnations.

You can find lots of further explanations and examples online at places like  W3Schools or SQL-tutorial.





Comments are closed.