Choosing Data Types Database Administration Fundamentals

Slides:



Advertisements
Similar presentations
 Variables  What are they?  Declaring and initializing variables  Common uses for variables  Variables you get “for free” in Processing ▪ Aka: Built-in.
Advertisements

Introduction to Computing Concepts Note Set 7. Overview Variables Data Types Basic Arithmetic Expressions ▫ Arithmetic.
Structured Query Language - SQL Carol Wolf Computer Science.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
Elementary Data Types Scalar Data Types Numerical Data Types Other
Data types and variables
Chapter 2 Data Types, Declarations, and Displays
1 Chapter 2 JAVA FUNDAMENTALS CONT’D. 2 PRIMITIVE DATA TYPES Computer programs operate on data values. Values in Java are classified according to their.
Storing data Getting data out Data types Ruby as a foundation Program Variables Click icon to hear comments (the download may take a minute)
Objectives You should be able to describe: Data Types
Basis Data Terapan Yoannita. SQL Server Data Types Character strings: Data typeDescriptionStorage char(n)Fixed-length character string. Maximum 8,000.
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
CPS120: Introduction to Computer Science
Primitive Variables.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Objects, Classes and Syntax Dr. Andrew Wallace PhD BEng(hons) EurIng
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Data types  CHAR (size): This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Methods and Data Programming with Alice and Java First Edition.
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
Copyright © – Curt Hill Types What they do.
INT213-Week-2 Working with Variables. What is variable
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Data Tonga Institute of Higher Education. Variables Programs need to remember values.  Example: A program that keeps track of sales needs to remember.
Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.
1.2 Primitive Data Types and Variables
Chapter One Lesson Three DATA TYPES ©
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Chapter 2. Variable and Data type
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
Basic Data Types อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 4.
Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use.
Review by Mr. Maasz, Summary of Chapter 2: Starting Out with Java.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Fundamentals 2.
Creating Database Objects
Chapter # 2 Part 2 Programs And data
Week 2 - Wednesday CS 121.
Chapter 2 Basic Computation
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
3.1 Denary, Binary and Hexadecimal Number Systems
Data Types and Structures
Data Types The type states how much and what kind of data the variable can store. integers- whole numbers no fractional parts int, short, long floating.
Understand Computer Storage and Data Types
Modified from Sharon Guffy
IDENTIFIERS CSC 111.
Data Types & File Size Calculations
C++ Data Types Data Type
Building Java Programs
Storing Negative Integers
Chapter # 2 Part 2 Programs And data
Chapter 2 Programming Basics.
Building Java Programs
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Introduction to Primitives
Building Java Programs
Variables Here we go.
Kirkwood Center for Continuing Education
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Building Java Programs
Creating Database Objects
Variables and Constants
Section 6 Primitive Data Types
Building Java Programs
Presentation transcript:

Choosing Data Types 98-364 Database Administration Fundamentals LESSON 2.1 98-364 Database Administration Fundamentals Choosing Data Types

Lesson Overview 2.1. Choose data types. Understanding what data types are, why they are important, and how they affect storage requirements. (This lesson focuses on Microsoft Access, MySQL, and Microsoft SQL Server data types.) In this lesson, you will review: Data types—a definition of a set of data Why data types are important How data types affect storage requirements Lesson 2.1 Overview

Data type—a definition of a set of data In programming, a definition of a set of data that specifies the possible range of values of the set, the operations that can be performed on the values, and the way in which the values are stored in memory. Defining the data type allows a computer to manipulate the data appropriately. Data types are most often supported in high-level languages and often include types such as real, integer, floating point, character, Boolean, and pointer. How a database language handles data typing is one of its major characteristics. “Data type” refers to the form that the data will be in. For instance: Is “9” the word nine or the value 9?

Examples of data types: Integer type is any whole number. 37; a positive number –50; a negative number Floating point type is any real number. 314,600,000 ; or 3146E5 in floating-point notation 0.0000451; or 451E-7 in floating-point notation

Examples of data types (continued) Character type is any number or letter that will not have math functions applied to it. House address: 5230 S. Windows St. Phone Number: 123-456-7890 Boolean type is only On or Off 1 or 0 True or False

Why data types are important Databases are made up of tables, and tables are made up of fields that are defined by their data types. Using the wrong data type can cause large performance degradation in the database and can lead to data corruption. Using the wrong data type can cause the database to use significantly more storage than needed, which is wasteful.

How data types affect storage requirements Each data type has a set amount of memory or storage that it will take up. The storage for most data types are fixed amounts even if the maximum space is not used. You want to choose the best data type for the necessary function and size. Three examples of different whole-number data types: Byte—Holds whole numbers from 0 to 255 in 1 byte of storage Integer — Holds whole numbers between – 32,768 and 32,7672 in 2 bytes of storage. Long—Holds whole numbers between – 2,147,483,648 and 2,147,483,647 in 4 bytes of storage. If a database never held a whole number larger then 255 but you used the long data type, your database would take up to four times more storage space than needed.

Data type and storage (continued) Three examples of character data types: Char(size)—Holds a fixed-length string. The fixed size is specified in parentheses. Holds a maximum of 8,000 characters. Varchar(size)—Holds a variable-length string. The maximum size is specified in parentheses. Holds a maximum of 8,000 characters. Text—Holds a variable-length character string. Maximum size is 2 GB of text data.

Pop Quiz What data type should be used to hold a student’s name, and why? What data type should be used to hold a student ID, and why? What data type should be used to hold a student’s grade, and why? 1) What data type should be used to hold a student’s name, and why? It should be the char type, in a variable-length character string. 2) What data type should be used to hold a student ID, and why? The char type is acceptable, but many students will also say to use the integer type, which is also acceptable. In either case, a variable-length character string should be used. 3) What data type should be used to hold a student’s grade? The answer depends on if whether the grade is expressed as a number or a letter. If it is a number, what type of number is being used, real or whole?