|
There are 12 lessons in this course:
- Introduction to Databases
- Fundamentals of SQL
- Building a database with SQL
- Storing & Retrieving Data
- Advanced SQL database access methods
- Database Security
- Using SQL in applications
- Cursors
- Stored procedures
- Error Handling
- Dynamic SQL
- Advice & Tips
Each lesson culminates in an assignment which is submitted to the school, marked by the school's tutors and returned to you with any relevant suggestions, comments, and if necessary, extra reading. The aims covered include:
- Understand the concept of relational databases.
- Understand the fundamentals of SQL.
- Build and maintain a database with SQL.
- Define how to store data in a database using SQL.
- Understand advanced and more efficient ways of working with databases in SQL.
- Keep databases secure with SQL.
- Understand how to use SQL in real world applications.
- Define how to use cursors to work with data in a database.
- Understand how to re-use common code and develop efficient database driven applications with the use of stored procedures.
- Define the benefits of error handling and how to implement it.
- Define how dynamic SQL works in applications.
What is SQL?
SQL (structured query language) is the most common language used for communicating with relational databases.
Traditionally, programming languages such as Basic, C# and C++ are known as ‘procedural’ languages. This means that in order to do something, a procedure is written telling the computer what to do.
For example, to get the computer to draw a box, you would have a procedure similar to the following:
- Move the pointer to the top left of the screen
- Draw a line horizontally until it reaches the edge of the screen
- Draw a line down until it reaches the bottom of the screen
- Draw a line to the left until it reaches the left hand side of the screen
- Draw a line up until it meets the top left corner of the screen
SQL is a ‘non-procedural’ language. Instead, you tell SQL what you want and it communicates with the DBMS to retrieve your request without you having to tell SQL exactly how to do it.
For example, to retrieve all records from a database where all people lived in Australia, you would use the following SQL command:
Select * from records where location=’Australia’
The DBMS then understands what SQL is asking and will go and retrieve the data and send it back to SQL.
SQL commands are performed in one of two ways:
1) Via a console
You can execute SQL commands via a console that is connected to a DBMS. This may be the SQL query builder in Microsoft Access, a web page connected to a database of some sort, or either via SQL Server Express, Enterprise Manager & Query Analyser for SQL Server. You would simply type in your request in SQL and after the task has been completed, you will see the result. This form of using SQL is generally only used by professional database administrators due to the large margin for error and lack of database security (someone could easily wipe out a database by typing the wrong command).
2) Via an application
This is the most common form of SQL programming. An application acts as a ‘front end’ for the database, allowing someone with basic computer knowledge to use a database. For example, a button that says ‘add record’ would appear on a page with blank fields for ‘name’ and ‘address’. The operator would enter the name and address then click the button. This button would then fire off an SQL command, telling the DBMS to add a new record to the database with the data the operator typed in.
|