5.8. Database Manipulation
Once you have a database designed and loaded with data, how will you do something useful with it? The primary way to work with a relational database is to use Structured Query Language (SQL) to analyze and manipulate relational data. Database Manipulation is the use of a programming language to modify data in a database to make it easier to view or for the purpose of decision making.
SQL (often pronounced sequel) stands for Structured Query Language, and is the most common language for creating and manipulating databases. You’ll find variants of SQL inhabiting everything from desktop software, to high-powered enterprise products. Given this popularity, if you’re going to learn one language for database use, SQL is a pretty good choice. To give you a taste of what SQL might look like, see the examples below using the School database data.
Example of a SQL Query
A query to retrieve the major of student John Smith from the Student table:
WHERE StudentName = ‘John Smith’;
A query to retrieve the total # of students in the Student table:
SQL can be embedded in many computer languages that are used to develop platform-independent web-based applications. An in-depth description of how SQL works is beyond the scope of this introductory text, but these examples should give you an idea of the power of using SQL to manipulate relational databases. Many DBMS, such as Microsoft Access, allow you to use QBE (Query-by-Example), a graphical query tool, to retrieve data though visualized commands. QBE generates SQL for you, and is easy to use. In comparison with SQL, QBE has limited functionalities and is unable to work without the DBMS environment.