Free Newsletters:
DatabaseDaily  
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed


follow us on Twitter





Brocade Doubles Down on 16 Gbps Fibre Channel

Microsoft Wants iOS Apps to Run on WP7

Avaya Debuts New Virtual Services Switch
Database Journal |DBA Support |SQLCourse |SQLCourse2







Technical Specialist – Pre-sales (MA)
Next Step Systems
US-MA-Littleton

Justtechjobs.com Post A Job | Post A Resume

Featured Database Articles

SQL etc

June 24, 2002

Introduction to Relational Databases - Page 3

By Ian Gilfillan


Views are virtual tables. They do not contain any data themselves - rather they're a structure to allow us to access data, or a subset of the data. A view can consist of a subset of one table, such as in this example:

Poet
  • Code
  • First name
  • Surname
  • Age
  • Address
  • Telephone

This is the complete list of fields from the poet table

Subscriber view
  • Code
  • First_name
  • Surname
  • Grade

This view could be used to allow others to see the poet's code, name and surname, but not allow them access to personal information. Or, a view could be a combination of a number of tables, such as in this example

: Poet
  • Code
  • First name
  • Surname
  • Age
  • Address
  • Telephone

Poem
  • Poem code
  • Poet code
  • Title

Subscriber view
  • First_name
  • Surname
  • Poem title

Views are often used for security purposes. Junior developers may need access to certain portions of a table, but they do not need access to all the data. What they don't need, even if it is from the same table, is hidden and safe from manipulation or viewing. Also, views allow SQL queries to be much simpler. For example, without views, a developer may have to use the following query:

	
SELECT first_name,surname,poem FROM poet,poem
WHERE poem.poet_code=poet.code AND poet.title='Once';

With the view, a developer could do the same with:

SELECT first_name,surname,poem from subscriber_view;

Much more simple for a junior developer who hasn't yet learnt how to do joins across multiple tables, and less hassle for a senior developer too!

This has been a brief introduction to relational databases. Hopefully it's put some of the terms you've come across in context, and whetted your appetite to explore further.

Additional Resources:


Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

SQL etc Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 



Latest Forum Threads
SQL etc Forum
Topic By Replies Updated
get records within same group and with condition jutiyi 3 January 12th, 03:07 PM
Database SQL help needed to check date range clashes! deadlydragon121 7 January 9th, 02:47 PM
Remove Alpha from data in Column disk244 0 November 19th, 11:13 AM
sql query releatıon record show and sub total and grand total thank you for your howerlover 0 November 18th, 01:55 AM