IT: e-government
IT: e-government

This free course is available to start right now. Review the full course description and key learning outcomes and create an account and enrol if you want a free statement of participation.

Free course

IT: e-government

3.4 Using a query language

When you search a large website for information, for instance when you search a large e-government site, very often, behind the scenes, a large relational database is being searched. I mentioned earlier the use of SQL as a way of extracting information from a database. Depending on the system being used, your enquiry may be converted into an SQL query, and this finds the information you need. For example, suppose we wanted to find the family names of all people enrolled on the digital photography course (E02) in the last section. Below is an SQL query to find this information. (There are other ways to construct this query using SQL.)

SELECT FAMILY_NAME

FROM TABLE_2 JOIN TABLE_4 ON TABLE_2.STUDENT_KEY=TABLE_4.STUDENT_KEY

WHERE COURSE_CODE='E02'

I will briefly explain how the query works. It is based on the idea of merging Tables 2 and 4 ('Table_2 join Table_4'), subject to certain constraints. One constraint is that the student_keys must be equal ('On Table_2.Student key=Table_4.Student_key'). In effect, the merged table is like Table 2, but with an extra column giving the course codes for each student. However, the only records included in this table are those for which the course code is E02, as specified in the condition 'Where course_code='E02''. The first instruction ('select family_name') retrieves the required information from this joint table.

T175_5

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to university level study, find out more about the types of qualifications we offer, including our entry level Access courses and Certificates.

Not ready for University study then browse over 900 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus