As a quick review, SQL is the language to interact with a relational database.
- to request data (SELECT) from database objects (databases, schemas, tables and views)
- to create (CREATE) where to store data, database objects (databases, schemas, tables including columns, etc.)
- to modify (ALTER) database objects
- to delete (DROP) database objects, automatic COMMIT in SQL Server hence no ROLLBACK (no way to rescue the data or objects)
- to manipulate data either affecting the data or not (showing data only)
- CREATE database_object object_name [other_code]
- DROP database_object object_name [other_code]
- ALTER database_object object_name ALTER|ADD|DROP [other_code]
- DELETE rows from a table
- INSERT INTO table (rows/records)
- TRUNCATE table (erasing all data in table)
- UPDATE table
We use SQL to return data to any person or program that needs data.
-
- Your boss or end user requests data as a report (RPT), graphic (GIF, JPEG, PNG, .BMP, etc.), an office file (XLS, DOC, etc. or other data types as PDF. The end user does not need to know where the data is or how to get it.
- You (the middle person handling errands) get the data from the database using SQL. Normally you would not take care of visualization, analysis and/or interpretation. You also do not need to understand the data, but you need to know your data (row ID of tables, keys or other constraints, etc.) and make sure the data is clean (no garbage data).
- The database holds the data that the end user needs and all SQL requests (SELECT, DROP, ALTER, etc.) if written currently (no syntax errors) return the data to you or directly to the end user. The database does not have AI and hence only returns what you ask. As such if you make the wrong request, the database would return the wrong data (your bad logic, not a syntax error).