SQL Server Table Design - Best Practices

Size: px
Start display at page:

Download "SQL Server Table Design - Best Practices"

Transcription

1 CwJ Consulting Ltd SQL Server Table Design - Best Practices Author: Andy Hogg Date: 20 th February 2015 Version: 1.11 SQL Server Table Design Best Practices 1

2 Contents 1. Introduction... 3 What is a table?... 3 Why is good table design important?... 3 What happens when a table isn t designed well? Clusters and Heaps... 4 Definition of Cluster and Heap... 4 More on clustered indices... 4 Using Identity... 6 Primary Keys, and Clustered Indices Dates and Times... 7 How not to store a Date \ Time... 7 Validation... 7 Culture... 8 Date and Time functionality... 9 Choosing the best Date \ Time data type to use Using the Time data type Advice on recording durations Strings Why a number should be a string How to decide Choosing the correct Integer The different Integer types Examples of poor choice Integers Approximate Data Types Deprecated Data Types What does deprecated mean? What are the deprecated data types? Table and Column Naming Spaces Prefixing \ Suffixing Tables and Views with tbl and vw Reserved Keywords Using P.e.r.i.o.d.s Constraints Enforcing business logic Enforcing data cleanliness Avoiding NULLs Improving performance One Page Summary for Better Tables

3 1. Introduction What is a table? A table is a collection of related data held in a structured format within a database. It consists of columns and rows. EmployeeNumber FirstName LastName 127 Fred Smith 254 Joachim Löw 874 Steve Jones 423 Ralf Little Relational Database engines (such as SQL Server) store, modify and retrieve data in this format. Why is good table design important? Table design has a huge effect on every aspect of system performance. For example the amount of storage used, the amount of memory used, the amount of processing power required, the likelihood of deadlocks, the integrity of the data etc. What happens when a table isn t designed well? Badly designed tables often perform well. At first However as time goes on, and the amount of data and level of concurrency (number of users) increases, problems begin to manifest themselves. Badly designed tables simply do not scale well. So systems which appear to work fine when first commissioned, will perform badly at an enterprise level with hundreds of users and billions of rows of data. SQL Server Table Design Best Practices 3

4 2. Clusters and Heaps Definition of Cluster and Heap Tables can store rows in either an ordered format, or an unordered format (known as a heap). Ordered storage stores the rows in the order of the values in a particular column or composite of columns. Heaps store rows in the order that they are inserted (although rows may be moved around later as data is modified). Ordering the table is implemented by applying a clustered index to the table. There are very few occasions when it is best to leave a table as a heap instead of applying a clustered index. These edge cases are few and far between. A good rule to follow is to always create a clustered index on a table. More on clustered indices Since a clustered index defines the order in which rows are stored, there can only ever be one clustered index on a table. This is because it s only possible to order something in one way at a time. For example, it s not possible to take a deck of cards and order it by value low to high and also to order it by value high to low, at the same time. You should give careful consideration when selecting which column or columns to use for the clustered index. The ideal cluster key has the following four properties:- 1. Static Base the cluster key on a column or composite of columns which contain nonvolatile values (values that will not change). Remember that the rows are ordered by the value of the cluster key, so if the value of the cluster key changes, the row is then out of order and must be moved. Avoid using volatile values in a cluster key. 2. Unique It is possible to create a clustered index on a column or composite of columns which contain non-unique values, but it is highly undesirable to do this. In the case on a non-unique cluster key, SQL Server needs to add a hidden 4 byte uniquifier column. This has a substantial impact on performance. Avoid non-unique clustered indices. 4

5 3. Narrow The ideal data type for a column being used as a cluster key is an INT. This is because at 4 bytes it is narrow, and narrowness is a hugely desirable property in cluster keys. It s possible to find clustered indices defined on very wide data types e.g. CHAR(250) or even a composite of several very wide data types. This is a bad design decision and will affect performance. Avoid using wide keys. 4. Increasing The ideal cluster key will use continually increasing values. It s very easy to store something in an order when it s already given in that order. For example, consider writing down the letters A,B,C,D,E,F,G,H in alphabetical order. Now consider writing down the letters J,W,Y,D,G,E,T,F in alphabetical order. Which would be the easiest and quickest task to perform? Use a continually incrementing value for the cluster key. SQL Server Table Design Best Practices 5

6 Using Identity SQL Server provides the facility to automatically generate an ever increasing integer value within a table s column. This is often good to use as a cluster key. When using the IDENTITY property, two parameters are specified. The first (the seed) specifies the number at which the automatic numbering should commence. The second (the increment) specifies how many gaps between each automatic number should be left. For example:- IDENTITY(1,1) will produce a series like this 1,2,3,4,5,6,7.. IDENTITY(100,1) will produce a series like this 100,101,102,103,104,105.. IDENTITY(1,2) will produce a series like this 1,3,5,7,9.. A very common design mistake that developers make when using IDENTITY, is to define this as an INT starting from 1 and incrementing by 1 so specifying IDENTITY(1,1). The range of values for an INT is -2,147,483,648 to 2,147,483,647. By starting the identity at 1, the range of usable values (and therefore the maximum number of rows in the table) is halved. Instead, start the IDENTITY at the lowest possible value i.e. negative. For an INT that would mean a seed of -2,147,483,648 to maximise the number of possible values. By specifying IDENTITY( ,1) the series would then run: , , , , Primary Keys, and Clustered Indices A primary key is a single field or combination of fields that uniquely defines a row. None of the fields that are part of the primary key can be nullable. A table can have only one primary key. By default, if a primary key is defined on a table in SQL Server, and no clustered index already exists on that table, then a clustered index will be automatically created with the same column definition as the primary key. Bear this in mind if you declare a primary key on a table. As defaults go, this isn t awful behaviour however like most defaults, one size never fits all cases. Be aware that the primary key and the cluster key don t have to use the same column or composite columns. Separating the definition of the primary key from the cluster key can sometimes be the correct design decision. 6

7 3. Dates and Times How not to store a Date \ Time A mistake that many developers often make when designing tables is to store date \ time data in a string e.g. a character data type such as CHAR, NCHAR, VARCHAR, NVARCHAR. We will discuss why this is a design anti-pattern in the following sections. Validation By not using one of the date \ time data types, no validation of the data takes place. For example it s possible to store a date such as the 30 th February, or a time such as 14:61:62 Compare this:- To this:- SQL Server Table Design Best Practices 7

8 Culture No regional culture information is stored when a date is stored as a string. For example given a date of , an English person would read this as the 3 rd of April, whereas an American would read this as the 4 th March. By storing this in a data type designed for the purpose, the day, month and year is tracked and we know what the date actually represents. We can also easily display it in formats for other nationalities:- 8

9 Date and Time functionality The T-SQL language has many built-in functions to make life much easier when querying and manipulating dates and times. However these functions cannot be used if the date or time is stored in a string format. An example of querying using built-in T-SQL functions:- SQL Server Table Design Best Practices 9

10 Choosing the best Date \ Time data type to use SQL Server offers 6 different data types for storing date and time data. Many people, know only of the DATETIME data type, and so use this automatically. Advice:- If storing dates, and the time component is not important or even recorded, then use the DATE data type instead. DATE will use 3 bytes, whereas DATETIME will use 8 bytes. Here's an example of a table using a DATETIME data type when a DATE would have clearly been a better choice:- Storing 00:00: for every row is wasteful. Here it costs (6 x 5) = 30 bytes per row. If storing times and the date component is not important or even recorded, then use the TIME data type instead and specify the precision that you need. TIME will use between 3-5 bytes (depending on precision), whereas DATETIME will use 8 bytes. 10

11 If storing both the date and time is a requirement, then consider using the SMALLDATETIME data type. SMALLDATETIME can store dates between January 1, 1900, - June 6, It stores time to a granularity of 1 second. Unless dates outside of this range are required, or fractional second precision is needed, then SMALLDATETIME is a better choice than DATETIME. SMALLDATETIME uses 4 bytes whereas DATETIME uses 8 bytes. Using the Time data type The TIME data type should only ever be used to record a point in time. It should never be used to record a duration of passing of time. For example a very bad use of the TIME data type would be to record hours worked. In the example below, it s difficult to try to calculate how many hours were worked in the week. SQL Server Table Design Best Practices 11

12 Advice on recording durations When faced with a requirement such as the one above, there are 2 different design patterns which are better solutions:- Design the table with a column for StartTime and a column for EndTime. Use the TIME or SMALLDATETIME data types for these. (Using TIME would assume that people never work past midnight, so SMALLDATETIME might be a better choice). Then use the date and time functions within T-SQL to calculate the duration between them. Design the table with a column named HoursWorked and a column named MinutesWorked. Use the TINYINT data type for both. 4. Strings Why a number should be a string. A common mistake often made with table design is to store a number in an integer format when it might be better be served as a string. A telephone number is a good example of this. By storing a telephone number as an integer, it s not possible to append leading zeroes to the number (needed for international dialling) or to add helpful telephone number punctuation like + or - or () or <space>. For example (0) Expressed as an integer that would be How to decide When deciding whether to store a number in some kind of numeric format, or as a string ask the question:- Will there be a need to perform any mathematical calculations on this value? If the answer to this question is no, then store the value as a string. For example, it s unlikely that you would need to find the sum of all your friends phone numbers. It s also unlikely that you would need to calculate the average phone number of all your contacts. 12

13 5. Choosing the correct Integer The different Integer types It s very common indeed to see the INT data type used exclusively in tables whenever a whole number needs to be stored. Many people are unaware that SQL Server supports 4 different INT data types, which have the following properties:- Data Type Range Storage BIGINT -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 8 Bytes INT -2,147,483,648 to 2,147,483,647 4 Bytes SMALLINT -32,768 to 32,767 2 Bytes TINYINT 0 to Byte Avoid immediately using an INT data type automatically without considering its smaller cousins. Examples of poor choice Integers Here are a couple of real world examples where more thought might have led to a better choice of data type:- A column which is an INT data type (so taking up 4 bytes of storage) yet only holding two possible values (33 or 36). This could have been implemented as a TINYINT data type (1 byte) saving 3 bytes per row. A column which is an INT data type (so taking up 4 bytes of storage) yet only holding four possible values (-1,0,1,2). This could have been implemented as a SMALLINT data type (2 bytes) saving 2 bytes per row. SQL Server Table Design Best Practices 13

14 6. Approximate Data Types T-SQL provides two data types FLOAT and REAL which can be used to store extremely small or extremely large numbers. However these two data types store an approximation of the value, as opposed to the exact value. The approximate nature of these 2 data types therefore means that their use is best avoided in any financial system. Instead, use the DECIMAL or NUMERIC data types. They are functionally the same, however the important point is that they store an exact value and not an approximation of one. Here s an example of a table which is using approximate data types to store financial data:- Unless these are incredibly small, or immensely huge numbers, the designer of this table might have been better advised to use the DECIMAL \ NUMERIC data types for these. 7. Deprecated Data Types What does deprecated mean? As newer versions of the SQL Server product are released over time, Microsoft removes outdated features. In order to give SQL Server users time to provision for these features being removed, Microsoft first mark these features as deprecated. A deprecated feature is one that is still available to use in the product, but which is scheduled to be removed from a later version of the product in the future. For this reason, it s important not to use deprecated data types in any new development work, since these data types have a finite life span. What are the deprecated data types? Currently, the following data types are deprecated:- TEXT NTEXT IMAGE 14

15 8. Table and Column Naming Spaces Avoid using spaces in table or column names. Table or column names with spaces in them must always be surrounded by delimited identifiers. For example compare these:- Prefixing \ Suffixing Tables and Views with tbl and vw Although many people make a case for typeful names, in the case of tables and views, experience suggests that this is a bad idea. Consider a single table named tbl_person which contains details of both permanent staff and contractors that is queried for reporting purposes. At some stage in the future, it s decided to change this by splitting tbl_person into two separate tables, one for contractors (tbl_contractor) and one for permanent staff (tbl_permanentstaff). To make this change without modifying the existing reporting queries, a view is created to replace the original Person table. The view simply unions the contents of the two new tables. The end result is a view named tbl_person. The prefix is now misleading because it s no longer a table, it s a view. Reserved Keywords The T-SQL language has a certain vocabulary of reserved keywords. These reserved keywords shouldn t be used as the name of a table or column. It is possible to use these reserved keywords as a name by using delimited identifiers, however this practice is strongly discouraged. A full list of reserved keywords may be found here. SQL Server Table Design Best Practices 15

16 Using P.e.r.i.o.d.s SQL Server uses the period to distinguish the levels of an object hierarchy. For example - Server.Database.Schema.Object Or often just Schema.Object Avoid using periods in any object or column name in SQL Server. So for example, don t name a table Gas.Operational.Cost.Estimate It is much safer to express this as either:- GasOperationalCostEstimate or Gas_Operational_Cost_Estimate 9. Constraints Constraints are a way of restricting which values are allowed to be stored in a column. They perform many useful functions. Enforcing business logic Constraints can prevent data being entered which contravenes business logic. For example if an error severity level should only ever be -1,0,1, or 2; then a CHECK constraint could be set to enforce this:- Or if an order in an order table should always have an assignment to a customer in a customer table, then a foreign key constraint could be used to enforce this. 16

17 Enforcing data cleanliness Constraints can be used to help with keeping data clean. For example in a Gender column we could set a CHECK constraint to restrict values to Male, Female or Unknown. This would prevent values being entered such as M, F, Man, Woman, Hombre etc. Avoiding NULLs In a database, a NULL means the value is not known or not applicable. NULL does not mean zero, nor does it mean (an empty string). In some cases, this may be reasonable. For example, a column that stores mobile phone numbers might allow NULLs, because not everyone has a mobile phone. However sometimes it s important to ensure that any record being added or modified has a compulsory piece of information specified. When a column value shouldn t be allowed to be omitted, use NOT NULL in the column definition. SQL Server Table Design Best Practices 17

18 Improving performance Constraints can help the SQL Server query optimiser to do a better job. Consider a bag of marbles of various colours. We know that there are 20 marbles in the bag, and that 12 of them are red. How many of the marbles are black? In order to answer this question we must empty out the bag and individually count the black marbles (because there might be marbles of other colours in the bag too). However, if a constraint is added The bag can only contain red or black marbles, then it s immediately obvious how many black marbles are in the bag, without the need to empty all the marbles out of the bag and count them. The SQL Server query optimiser can take such logical short-cuts if constraints are defined on columns. 18

19 10. One Page Summary for Better Tables Design tables properly from the outset to avoid future problems. Define a clustered index on tables. Always use a cluster key that is static, unique, narrow, and incrementing. If you have a composite cluster key which uses a combination of more than three columns, you should probably rethink your table design. Consider creating an ID column for the cluster key, and use the IDENTITY property As a mechanism to populate it. If using the IDENTITY property, seed it with the lowest value possible. Remember that a primary key and a cluster key don t have to use the same columns. Don t store dates and times as strings. Consider various different data types for suitability, rather than just automatically using INT or DATETIME. Don t use the TIME data type to record a duration of time. Don t automatically store a number as an INT (e.g. a phone number is better stored as text). Don t use FLOAT and REAL data types to represent financial data. Don t create any new tables which use deprecated data types. Don t use spaces or periods in table or column names. Don t use reserved keywords in table or column names. Don t prefix \ suffix tables or views with tbl or vw. Use constraints whenever applicable. If a column shouldn t contain NULL values then define it as NOT NULL. SQL Server Table Design Best Practices 19

Using SQL Server Management Studio

Using SQL Server Management Studio Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases

More information

How To Create A Table In Sql 2.5.2.2 (Ahem)

How To Create A Table In Sql 2.5.2.2 (Ahem) Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

MS ACCESS DATABASE DATA TYPES

MS ACCESS DATABASE DATA TYPES MS ACCESS DATABASE DATA TYPES Data Type Use For Size Text Memo Number Text or combinations of text and numbers, such as addresses. Also numbers that do not require calculations, such as phone numbers,

More information

Once the schema has been designed, it can be implemented in the RDBMS.

Once the schema has been designed, it can be implemented in the RDBMS. 2. Creating a database Designing the database schema... 1 Representing Classes, Attributes and Objects... 2 Data types... 5 Additional constraints... 6 Choosing the right fields... 7 Implementing a table

More information

10+ tips for upsizing an Access database to SQL Server

10+ tips for upsizing an Access database to SQL Server 10 Things 10+ tips for upsizing an Access database to SQL Server Page 1 By Susan Harkins July 31, 2008, 8:03 AM PDT Takeaway: When the time comes to migrate your Access database to SQL Server, you could

More information

Introduction This document s purpose is to define Microsoft SQL server database design standards.

Introduction This document s purpose is to define Microsoft SQL server database design standards. Introduction This document s purpose is to define Microsoft SQL server database design standards. The database being developed or changed should be depicted in an ERD (Entity Relationship Diagram). The

More information

Black Hat Briefings USA 2004 Cameron Hotchkies cameron@0x90.org

Black Hat Briefings USA 2004 Cameron Hotchkies cameron@0x90.org Blind SQL Injection Automation Techniques Black Hat Briefings USA 2004 Cameron Hotchkies cameron@0x90.org What is SQL Injection? Client supplied data passed to an application without appropriate data validation

More information

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database.

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database. Physical Design Physical Database Design (Defined): Process of producing a description of the implementation of the database on secondary storage; it describes the base relations, file organizations, and

More information

ODBC Client Driver Help. 2015 Kepware, Inc.

ODBC Client Driver Help. 2015 Kepware, Inc. 2015 Kepware, Inc. 2 Table of Contents Table of Contents 2 4 Overview 4 External Dependencies 4 Driver Setup 5 Data Source Settings 5 Data Source Setup 6 Data Source Access Methods 13 Fixed Table 14 Table

More information

Information Systems SQL. Nikolaj Popov

Information Systems SQL. Nikolaj Popov Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying

More information

B.1 Database Design and Definition

B.1 Database Design and Definition Appendix B Database Design B.1 Database Design and Definition Throughout the SQL chapter we connected to and queried the IMDB database. This database was set up by IMDB and available for us to use. But

More information

SQL Server Database Coding Standards and Guidelines

SQL Server Database Coding Standards and Guidelines SQL Server Database Coding Standards and Guidelines http://www.sqlauthority.com Naming Tables: Stored Procs: Triggers: Indexes: Primary Keys: Foreign Keys: Defaults: Columns: General Rules: Rules: Pascal

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

Introduction to Microsoft Jet SQL

Introduction to Microsoft Jet SQL Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of

More information

Ontrack PowerControls V8.1 for SQL ReadMe

Ontrack PowerControls V8.1 for SQL ReadMe Ontrack PowerControls V8.1 for SQL ReadMe Contents About the Free Trial Supported Environments Ontrack PowerControls Licensing Ontrack PowerControls Agents Limitations Technical Support About Kroll Ontrack

More information

sqlite driver manual

sqlite driver manual sqlite driver manual A libdbi driver using the SQLite embedded database engine Markus Hoenicka mhoenicka@users.sourceforge.net sqlite driver manual: A libdbi driver using the SQLite embedded database engine

More information

Oracle Database 10g Express

Oracle Database 10g Express Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives

More information

Using Microsoft Access

Using Microsoft Access Using Microsoft Access USING MICROSOFT ACCESS 1 Queries 2 Exercise 1. Setting up a Query 3 Exercise 2. Selecting Fields for Query Output 4 Exercise 3. Saving a Query 5 Query Criteria 6 Exercise 4. Adding

More information

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today. & & 1 & 2 Lecture #7 2008 3 Terminology Structure & & Database server software referred to as Database Management Systems (DBMS) Database schemas describe database structure Data ordered in tables, rows

More information

Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

More information

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7 SQL DATA DEFINITION: KEY CONSTRAINTS CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7 Data Definition 2 Covered most of SQL data manipulation operations Continue exploration of SQL

More information

not at all a manual simply a quick how-to-do guide

not at all a manual simply a quick how-to-do guide not at all a manual simply a quick how-to-do guide As a general rule, the GUI implemented by spatialite-gis is closely related to the one implemented by the companion app spatialite-gui So, if you are

More information

Guide to Upsizing from Access to SQL Server

Guide to Upsizing from Access to SQL Server Guide to Upsizing from Access to SQL Server An introduction to the issues involved in upsizing an application from Microsoft Access to SQL Server January 2003 Aztec Computing 1 Why Should I Consider Upsizing

More information

Microsoft SQL connection to Sysmac NJ Quick Start Guide

Microsoft SQL connection to Sysmac NJ Quick Start Guide Microsoft SQL connection to Sysmac NJ Quick Start Guide This Quick Start will show you how to connect to a Microsoft SQL database it will not show you how to set up the database. Watch the corresponding

More information

White Paper. Blindfolded SQL Injection

White Paper. Blindfolded SQL Injection White Paper In the past few years, SQL Injection attacks have been on the rise. The increase in the number of Database based applications, combined with various publications that explain the problem and

More information

A basic create statement for a simple student table would look like the following.

A basic create statement for a simple student table would look like the following. Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));

More information

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

Developing Web Applications for Microsoft SQL Server Databases - What you need to know Developing Web Applications for Microsoft SQL Server Databases - What you need to know ATEC2008 Conference Session Description Alpha Five s web components simplify working with SQL databases, but what

More information

Financial Data Access with SQL, Excel & VBA

Financial Data Access with SQL, Excel & VBA Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,

More information

SQL Server. 1. What is RDBMS?

SQL Server. 1. What is RDBMS? SQL Server 1. What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained

More information

Access Queries (Office 2003)

Access Queries (Office 2003) Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy

More information

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013 CSE 530A Database Management Systems Introduction Washington University Fall 2013 Overview Time: Mon/Wed 7:00-8:30 PM Location: Crow 206 Instructor: Michael Plezbert TA: Gene Lee Websites: http://classes.engineering.wustl.edu/cse530/

More information

Microsoft Access 2010

Microsoft Access 2010 IT Training Microsoft Access 2010 Jane Barrett, IT Training & Engagement Team Information System Services Version 3.0 Scope Learning outcomes Learn how to navigate around Access. Learn how to design and

More information

Advance DBMS. Structured Query Language (SQL)

Advance DBMS. Structured Query Language (SQL) Structured Query Language (SQL) Introduction Commercial database systems use more user friendly language to specify the queries. SQL is the most influential commercially marketed product language. Other

More information

Ontrack PowerControls User Guide Version 8.0

Ontrack PowerControls User Guide Version 8.0 ONTRACK POWERCONTROLS Ontrack PowerControls User Guide Version 8.0 Instructions for operating Ontrack PowerControls in Microsoft SQL Server Environments NOVEMBER 2014 NOTICE TO USERS Ontrack PowerControls

More information

IT2304: Database Systems 1 (DBS 1)

IT2304: Database Systems 1 (DBS 1) : Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation

More information

Comparison of Open Source RDBMS

Comparison of Open Source RDBMS Comparison of Open Source RDBMS DRAFT WORK IN PROGRESS FEEDBACK REQUIRED Please send feedback and comments to s.hetze@linux-ag.de Selection of the Candidates As a first approach to find out which database

More information

Best Practices in SQL Programming. Madhivanan

Best Practices in SQL Programming. Madhivanan Best Practices in SQL Programming Madhivanan Do not use irrelevant datatype VARCHAR instead of DATETIME CHAR(N) instead of VARCHAR(N) etc Do not use VARCHAR instead of DATETIME create table #employee_master(emp_id

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

Optimizing Your Data Warehouse Design for Superior Performance

Optimizing Your Data Warehouse Design for Superior Performance Optimizing Your Data Warehouse Design for Superior Performance Lester Knutsen, President and Principal Database Consultant Advanced DataTools Corporation Session 2100A The Problem The database is too complex

More information

Brief background What the presentation is meant to cover: Relational, OLTP databases the type that 90% of our applications use

Brief background What the presentation is meant to cover: Relational, OLTP databases the type that 90% of our applications use Brief background What the presentation is meant to cover: Relational, OLTP databases the type that 90% of our applications use What s out of scope: Non-relational databases OLAP/decision support data structures,

More information

CSC 443 Data Base Management Systems. Basic SQL

CSC 443 Data Base Management Systems. Basic SQL CSC 443 Data Base Management Systems Lecture 6 SQL As A Data Definition Language Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured

More information

Using Microsoft Access

Using Microsoft Access Using Microsoft Access Microsoft Access is a computer application used to create and work with databases. In computer jargon that means it s a Database Management System or DBMS. So what is a database?

More information

ETL Process in Data Warehouse. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT

ETL Process in Data Warehouse. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT ETL Process in Data Warehouse G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT Outline ETL Extraction Transformation Loading ETL Overview Extraction Transformation Loading ETL To get data out of

More information

Microsoft SQL Server Connector for Apache Hadoop Version 1.0. User Guide

Microsoft SQL Server Connector for Apache Hadoop Version 1.0. User Guide Microsoft SQL Server Connector for Apache Hadoop Version 1.0 User Guide October 3, 2011 Contents Legal Notice... 3 Introduction... 4 What is SQL Server-Hadoop Connector?... 4 What is Sqoop?... 4 Supported

More information

4 Simple Database Features

4 Simple Database Features 4 Simple Database Features Now we come to the largest use of iseries Navigator for programmers the Databases function. IBM is no longer developing DDS (Data Description Specifications) for database definition,

More information

Table and field properties Tables and fields also have properties that you can set to control their characteristics or behavior.

Table and field properties Tables and fields also have properties that you can set to control their characteristics or behavior. Create a table When you create a database, you store your data in tables subject-based lists that contain rows and columns. For instance, you can create a Contacts table to store a list of names, addresses,

More information

20464C: Developing Microsoft SQL Server Databases

20464C: Developing Microsoft SQL Server Databases 20464C: Developing Microsoft SQL Server Databases Course Details Course Code: Duration: Notes: 20464C 5 days This course syllabus should be used to determine whether the course is appropriate for the students,

More information

Optimizing Performance. Training Division New Delhi

Optimizing Performance. Training Division New Delhi Optimizing Performance Training Division New Delhi Performance tuning : Goals Minimize the response time for each query Maximize the throughput of the entire database server by minimizing network traffic,

More information

Tutorial on Relational Database Design

Tutorial on Relational Database Design Tutorial on Relational Database Design Introduction Relational database was proposed by Edgar Codd (of IBM Research) around 1969. It has since become the dominant database model for commercial applications

More information

Firebird. Embedded SQL Guide for RM/Cobol

Firebird. Embedded SQL Guide for RM/Cobol Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...6 1.1. General...6 1.2. Reading this Guide...6 1.3. Definition of Terms...6 1.4. Declaring

More information

SQL. Short introduction

SQL. Short introduction SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.

More information

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

StruxureWare Power Monitoring 7.0.1. Database Upgrade FAQ

StruxureWare Power Monitoring 7.0.1. Database Upgrade FAQ StruxureWare Power Monitoring 7.0.1 Database Upgrade FAQ Document Overview Author Power Software, Schneider Electric Last Revised 10 th July 2012 Document Purpose Upgrading ION-Enterprise to StruxureWare

More information

Chapter 5. Microsoft Access

Chapter 5. Microsoft Access Chapter 5 Microsoft Access Topic Introduction to DBMS Microsoft Access Getting Started Creating Database File Database Window Table Queries Form Report Introduction A set of programs designed to organize,

More information

Introduction to SQL for Data Scientists

Introduction to SQL for Data Scientists Introduction to SQL for Data Scientists Ben O. Smith College of Business Administration University of Nebraska at Omaha Learning Objectives By the end of this document you will learn: 1. How to perform

More information

www.dotnetsparkles.wordpress.com

www.dotnetsparkles.wordpress.com Database Design Considerations Designing a database requires an understanding of both the business functions you want to model and the database concepts and features used to represent those business functions.

More information

Database Query 1: SQL Basics

Database Query 1: SQL Basics Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic

More information

Database Migration : An In Depth look!!

Database Migration : An In Depth look!! Database Migration : An In Depth look!! By Anil Mahadev anilm001@gmail.com As most of you are aware of the fact that just like operating System migrations are taking place, databases are no different.

More information

What is a database? The parts of an Access database

What is a database? The parts of an Access database What is a database? Any database is a tool to organize and store pieces of information. A Rolodex is a database. So is a phone book. The main goals of a database designer are to: 1. Make sure the data

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

Title. Syntax. stata.com. odbc Load, write, or view data from ODBC sources. List ODBC sources to which Stata can connect odbc list

Title. Syntax. stata.com. odbc Load, write, or view data from ODBC sources. List ODBC sources to which Stata can connect odbc list Title stata.com odbc Load, write, or view data from ODBC sources Syntax Menu Description Options Remarks and examples Also see Syntax List ODBC sources to which Stata can connect odbc list Retrieve available

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Database Migration from MySQL to RDM Server

Database Migration from MySQL to RDM Server MIGRATION GUIDE Database Migration from MySQL to RDM Server A Birdstep Technology, Inc. Raima Embedded Database Division Migration Guide Published: May, 2009 Author: Daigoro F. Toyama Senior Software Engineer

More information

Dataset Management with Microsoft Access

Dataset Management with Microsoft Access The Institute for Economic Development Boston University Introduction Dataset Management with Microsoft Access The purpose of this document is to familiarize users with ways to import datasets and construct

More information

Microsoft Office 2010: Access 2010, Excel 2010, Lync 2010 learning assets

Microsoft Office 2010: Access 2010, Excel 2010, Lync 2010 learning assets Microsoft Office 2010: Access 2010, Excel 2010, Lync 2010 learning assets Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below. Titles Microsoft

More information

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen LECTURE 14: DATA STORAGE AND REPRESENTATION Data Storage Memory Hierarchy Disks Fields, Records, Blocks Variable-length

More information

Database 2 Lecture I. Alessandro Artale

Database 2 Lecture I. Alessandro Artale Free University of Bolzano Database 2. Lecture I, 2003/2004 A.Artale (1) Database 2 Lecture I Alessandro Artale Faculty of Computer Science Free University of Bolzano Room: 221 artale@inf.unibz.it http://www.inf.unibz.it/

More information

Database Design Patterns. Winter 2006-2007 Lecture 24

Database Design Patterns. Winter 2006-2007 Lecture 24 Database Design Patterns Winter 2006-2007 Lecture 24 Trees and Hierarchies Many schemas need to represent trees or hierarchies of some sort Common way of representing trees: An adjacency list model Each

More information

Specifications of Paradox for Windows

Specifications of Paradox for Windows Specifications of Paradox for Windows Appendix A 1 Specifications of Paradox for Windows A IN THIS CHAPTER Borland Database Engine (BDE) 000 Paradox Standard Table Specifications 000 Paradox 5 Table Specifications

More information

DATABASE ADMINISTRATION SQL SERVER STANDARDS

DATABASE ADMINISTRATION SQL SERVER STANDARDS DATABASE ADMINISTRATION SQL SERVER STANDARDS SQL Server Naming Conventions and Standards 3 1.0 Databases, Files, and File Paths 3 2.0 Tables and Views 3 3.0 Columns 3 4.0 Indexes 3 5.0 Stored Procedures

More information

Structured Query Language. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

Structured Query Language. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Structured Query Language HANS- PETTER HALVORSEN, 2014.03.03 Faculty of Technology, Postboks 203,

More information

Lab Manual. Databases. Microsoft Access. Peeking into Computer Science Access Lab manual

Lab Manual. Databases. Microsoft Access. Peeking into Computer Science Access Lab manual Lab Manual Databases Microsoft Access 1 Table of Contents Lab 1: Introduction to Microsoft Access... 3 Getting started... 3 Tables... 3 Primary Keys... 6 Field Properties... 7 Validation Rules... 11 Input

More information

Blindfolded SQL Injection. Written By: Ofer Maor Amichai Shulman

Blindfolded SQL Injection. Written By: Ofer Maor Amichai Shulman Blindfolded SQL Injection Written By: Ofer Maor Amichai Shulman Table of Contents Overview...3 Identifying Injections...5 Recognizing Errors...5 Locating Errors...6 Identifying SQL Injection Vulnerable

More information

INTRODUCTION TO MICROSOFT ACCESS Tables, Queries, Forms & Reports

INTRODUCTION TO MICROSOFT ACCESS Tables, Queries, Forms & Reports INTRODUCTION TO MICROSOFT ACCESS Tables, Queries, Forms & Reports Introduction...2 Tables...3 Designing a Table...3 Data Types...4 Relationships...8 Saving Object Designs and Saving Data...9 Queries...11

More information

Working with DB2 UDB objects

Working with DB2 UDB objects Working with DB2 UDB objects http://www7b.software.ibm.com/dmdd/ Table of Contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Introduction...

More information

Database Database Management System (DBMS)

Database Database Management System (DBMS) Database Database Management System (DBMS) Introduction to databases A database is a collection of structured and related data items organized so as to provide a consistent and controlled access to items.

More information

Choosing a Data Model for Your Database

Choosing a Data Model for Your Database In This Chapter This chapter describes several issues that a database administrator (DBA) must understand to effectively plan for a database. It discusses the following topics: Choosing a data model for

More information

Developing Microsoft SQL Server Databases (20464) H8N64S

Developing Microsoft SQL Server Databases (20464) H8N64S HP Education Services course data sheet Developing Microsoft SQL Server Databases (20464) H8N64S Course Overview In this course, you will be introduced to SQL Server, logical table design, indexing, query

More information

How Strings are Stored. Searching Text. Setting. ANSI_PADDING Setting

How Strings are Stored. Searching Text. Setting. ANSI_PADDING Setting How Strings are Stored Searching Text SET ANSI_PADDING { ON OFF } Controls the way SQL Server stores values shorter than the defined size of the column, and the way the column stores values that have trailing

More information

How To Understand The Basic Concepts Of A Database And Data Science

How To Understand The Basic Concepts Of A Database And Data Science Database Concepts Using Microsoft Access lab 9 Objectives: Upon successful completion of Lab 9, you will be able to Understand fundamental concepts including database, table, record, field, field name,

More information

SQL: joins. Practices. Recap: the SQL Select Command. Recap: Tables for Plug-in Cars

SQL: joins. Practices. Recap: the SQL Select Command. Recap: Tables for Plug-in Cars Recap: the SQL Select Command SQL: joins SELECT [DISTINCT] sel_expression [, sel_expression ] FROM table_references [WHERE condition] [GROUPBY column [,column ] [[HAVING condition]] [ORDER BY columns [ASC

More information

FHE DEFINITIVE GUIDE. ^phihri^^lv JEFFREY GARBUS. Joe Celko. Alvin Chang. PLAMEN ratchev JONES & BARTLETT LEARN IN G. y ti rvrrtuttnrr i t i r

FHE DEFINITIVE GUIDE. ^phihri^^lv JEFFREY GARBUS. Joe Celko. Alvin Chang. PLAMEN ratchev JONES & BARTLETT LEARN IN G. y ti rvrrtuttnrr i t i r : 1. FHE DEFINITIVE GUIDE fir y ti rvrrtuttnrr i t i r ^phihri^^lv ;\}'\^X$:^u^'! :: ^ : ',!.4 '. JEFFREY GARBUS PLAMEN ratchev Alvin Chang Joe Celko g JONES & BARTLETT LEARN IN G Contents About the Authors

More information

Developing Microsoft SQL Server Databases 20464C; 5 Days

Developing Microsoft SQL Server Databases 20464C; 5 Days Developing Microsoft SQL Server Databases 20464C; 5 Days Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc Course Description

More information

Fact Sheet In-Memory Analysis

Fact Sheet In-Memory Analysis Fact Sheet In-Memory Analysis 1 Copyright Yellowfin International 2010 Contents In Memory Overview...3 Benefits...3 Agile development & rapid delivery...3 Data types supported by the In-Memory Database...4

More information

Database Development and Management with SQL

Database Development and Management with SQL Chapter 4 Database Development and Management with SQL Objectives Get started with SQL Create database objects with SQL Manage database objects with SQL Control database object privileges with SQL 4.1

More information

MySQL Storage Engines

MySQL Storage Engines MySQL Storage Engines Data in MySQL is stored in files (or memory) using a variety of different techniques. Each of these techniques employs different storage mechanisms, indexing facilities, locking levels

More information

LOBs were introduced back with DB2 V6, some 13 years ago. (V6 GA 25 June 1999) Prior to the introduction of LOBs, the max row size was 32K and the

LOBs were introduced back with DB2 V6, some 13 years ago. (V6 GA 25 June 1999) Prior to the introduction of LOBs, the max row size was 32K and the First of all thanks to Frank Rhodes and Sandi Smith for providing the material, research and test case results. You have been working with LOBS for a while now, but V10 has added some new functionality.

More information

Contents WEKA Microsoft SQL Database

Contents WEKA Microsoft SQL Database WEKA User Manual Contents WEKA Introduction 3 Background information. 3 Installation. 3 Where to get WEKA... 3 Downloading Information... 3 Opening the program.. 4 Chooser Menu. 4-6 Preprocessing... 6-7

More information

MS Access Lab 2. Topic: Tables

MS Access Lab 2. Topic: Tables MS Access Lab 2 Topic: Tables Summary Introduction: Tables, Start to build a new database Creating Tables: Datasheet View, Design View Working with Data: Sorting, Filtering Help on Tables Introduction

More information

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

More information

Chapter 4: Database Design

Chapter 4: Database Design Chapter 4: Chapter 4: Objectives Understand data integrity concepts. Learn how to normalize data. Work with SQL Server s tools for enforcing data integrity. Implement primary and foreign keys. Use Declarative

More information

Database Encryption Design Considerations and Best Practices for ASE 15

Database Encryption Design Considerations and Best Practices for ASE 15 Database Encryption Design Considerations and Best Practices for ASE 15 By Jeffrey Garbus, Soaring Eagle Consulting Executive Overview This article will explore best practices and design considerations

More information

Administração e Optimização de BDs

Administração e Optimização de BDs Departamento de Engenharia Informática 2010/2011 Administração e Optimização de BDs Aula de Laboratório 1 2º semestre In this lab class we will address the following topics: 1. General Workplan for the

More information

http://mssqlfun.com/ Data Compression Rohit Garg

http://mssqlfun.com/ Data Compression Rohit Garg http://mssqlfun.com/ Data Compression Rohit Garg Table of Contents Data Compression... 2 Types of Database Compression... 2 Understanding Data Compression Types... 2 Implementation of Data Compression...

More information

- Suresh Khanal. http://mcqsets.com. http://www.psexam.com Microsoft Excel Short Questions and Answers 1

- Suresh Khanal. http://mcqsets.com. http://www.psexam.com Microsoft Excel Short Questions and Answers 1 - Suresh Khanal http://mcqsets.com http://www.psexam.com Microsoft Excel Short Questions and Answers 1 Microsoft Access Short Questions and Answers with Illustrations Part I Suresh Khanal Kalanki, Kathmandu

More information

Knocker main application User manual

Knocker main application User manual Knocker main application User manual Author: Jaroslav Tykal Application: Knocker.exe Document Main application Page 1/18 U Content: 1 START APPLICATION... 3 1.1 CONNECTION TO DATABASE... 3 1.2 MODULE DEFINITION...

More information