Chapter 3. Working with Tables and Views

A table is the basic unit of storage in a relational database. Tables and relationships (elements that link tables) are the most important elements of the relational model, which was designed by E. F. Codd in 1970. A table is composed of columns and a set of rows. First, a column represents an attribute of the entity described by the table. For example, an employee table might have these columns: Social Security number (SSN), first name, and last name. Second, a row, or a tuple, contains the actual data that is stored in a table. In the employee's example, if there are 10 employees in the company, this table will contain 10 rows.

A database object similar to tables in the way it is queried is a view. A view, also called a virtual table, is basically a predefined query stored in a database; every time the view is queried, SQL Server reads its definition and uses this definition to access the underlying table. Views add a layer between applications and tables because, through views, applications don't have to query tables directly.

In previous versions of SQL Server, a view never stored data. Now, using a new feature of SQL Server 2000 called indexed views, youcan create indexes on views (with some restrictions), and this translates into permanent storage of the result set produced by the view.

This chapter teaches you the following:

  • How to create and modify tables

  • The types of tables available in SQL Server

  • The advantages and usage of views

  • How to use extended properties to store metadata (information that describes objects) in a database

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.130.201