Creating Database Objects

Slides:



Advertisements
Similar presentations
CIT 613: Relational Database Development using SQL Revision of Tables and Data Types.
Advertisements

Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Structured Query Language - SQL Carol Wolf Computer Science.
Representing Data Elements Gayatri Gopalakrishnan.
Databases Lab 5 Further Select Statements. Functions in SQL There are many types of functions provided. The ones that are used most are: –Date and Time.
Chapter 2 Data Types, Declarations, and Displays
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Databases Tutorial 2 Further Select Statements. Objectives for Week Data types Sort retrieved data Formatting output.
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Introduction to SQL  SQL or sequel  It is a standardised language with thousands of pages in the standard  It can be in database system through GUI,
Working with Data Types February 7, 2015 John Deardurff Website:
Module 2 Working with Data Types. Module Overview Using Data Types Working with Character Data Converting Data Types Working with Specialized Data Types.
 Value, Variable and Data Type  Type Conversion  Arithmetic Expression Evaluation  Scope of variable.
Copyright © 2002 W. A. Tucker1 Chapter 7 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
1 SQL Tarek El-Shishtawy Professor Ass. Of Computer Engineering.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
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 Lesson 4. Skills Matrix Table A table stores your data. Tables are relational in that they are organized as rows and columns (a matrix). Each.
Session 11 Creating Tables and Using Data Types. RDBMS and Data Management/Session 11/2 of 40 Session Objectives Define the data types and list the categories.
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.
IMS 4212: Data Modeling—Attributes and Domains 1 Dr. Lawrence West, Management Dept., University of Central Florida Attributes and Domains.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
Introduction ABAP Fields and Variables. Slide 2 Fields (Introduction) In ABAP, fields (or data objects) are named locations in memory Variables store.
Academic Year 2015 Autumn. MODULE CC2006NI: Data Modelling and Database Systems Academic Year 2015 Autumn.
A data type in a programming language is a set of data with values having predefined characteristics.data The language usually specifies:  the range.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
What is your Character Data Type? March 5, 2016 John Deardurff Website:
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Standards and Conventions
3 A Guide to MySQL.
Creating Database Objects
Introduction To Oracle
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Data Definition and Data Types
Module 2: Creating Data Types and Tables
Fundamentals of PL/SQL part 1 (Basics)
Object Oriented Programming
SQL – Data types.
Data Definition and Data Types
Lesson 7 Managing Data Creating a database with Web Matrix.
Attributes and Domains
2. Understanding VB Variables
SQL Server 2016 JSON Support FOR Data Warehousing
SQL Implementation & Administration
ORACLE SQL Developer & SQLPLUS Statements
Proper DataType Usage = Guaranteed Better Performance and Accuracy
IDENTIFIERS CSC 111.
What is your Character Data Type?
Working with Data Types
Database systems Lecture 2 – Data Types
A JSON’s Journey through SQL Server
C++ Data Types Data Type
PT2520 Unit 5: Physical Design
Attributes and Domains
Data Types and Expressions
SQL (Structured Query Language)
Introduction to SQL Server and the Structure Query Language
Presentation transcript:

Creating Database Objects Lesson 2

Objectives

Data Types A data type is an attribute that specifies the type of data that an object can hold and it also specifies how many bytes each data type takes up. SQL Server 2008’s built-in data types are organized by these general categories: Exact Numbers Approximate Numbers Date and Time Character Strings Unicode Character Strings Binary Strings Other Data Types CLR Data Types Spatial Data Types

Data Types Money (Numeric) - This numeric data type is used in places where you want money or currency. Datetime - The datetime date and time data type is used to store date and time data in many different formats Integer - The int numeric data type is used to store mathematical computations and is used when you do not require a decimal point output.

Data Types Varchar - This character string data type is commonly used in databases where you are supporting English attributes nvarchar – Used for non-English languages Boolean - Otherwise known as a bit data type. Float - This numeric data type is commonly used in the scientific community and is considered an approximate-number data type.

Data Types

Implicit and Explicit Conversions SQL Server supports implicit conversions, which can occur without specifying the actual callout function (cast or convert). Explicit conversions actually require you to use the functions cast or convert specifically.

Views A view is simply a virtual table consisting of different columns from one or more tables. Unlike a table, a view is stored in the database as a query object; therefore, a view is an object that obtains its data from one or more tables.

Stored Procedures A stored procedure is a previously written SQL statement which has been “stored” or saved into the database. One of the things that will save you time when running the same query over and over again is to create a stored procedure, which you can then execute from within the database’s command environment.

SQL Injections A SQL injection is an attack in which malicious code is inserted into strings which are later passed on to instances of SQL Server waiting for parsing and execution. Any procedure which constructs SQL statements should be reviewed continually for injection vulnerabilities because SQL Server will execute all syntactically valid queries from any source.

Summary A data type is an attribute that specifies the type of data that an object can hold and it also specifies how many bytes each data type takes up. As a general rule, if you have two data types that are similar but only differ in how many bytes each data type uses, it has a larger range of values and/or has increased precision. SQL Server includes a wide range of pre-defined data types called built-in data types. Most databases that you create or use only need to use these datatypes.

Summary Exact numeric data types are the most common SQL Server data types used to store numeric information. int is the primary integer (whole number) data type. Precision (p) is the maximum total number of decimal digits which could be stored, both to the left and to the right of the decimal point; this value must be a minimum of 1 and a maximum of 38. The default precision number is 18.

Summary money and smallmoney are Transact-SQL data types you would use to represent monetary or currency values. Both data types are accurate to 10,000th of the monetary units which they represent. Approximate numeric data types are not as commonly used as other SQL Server data types. If you need more precision (more decimal places) than what is available in the exact numeric data type, you need to use float or real. These data types typically take additional bytes of storage.

Summary The date and time data types, of course, deal with dates and time. These data types include date, datetime2, datetime, datetimeoffset, smalldatetime and time. SQL Server supports implicit conversions, which can occur without specifying the actual callout function (cast or convert). Explicit conversions actually require you to use the functions cast or convert specifically.

Summary A regular character uses one byte of storage for each character, which allows you to define one of 256 (8 bits are in a byte and 2^8=256) possible characters which accommodate English and some European languages. A Unicode character uses two bytes of storage per character so that you can represent one of 65,536 (16 bits are in a 2 bytes and 2^16=65,536 characters). The additional character allows it to store characters from just about any language.

Summary When you use a VAR element, SQL Server will preserve space in the row it resides based on the column’s defined size and not on the actual number of characters found in the character string itself. The Unicode character strings nchar and nvarchar can either be fixed or variable like their regular character strings; they use the UNICODE UCS-2 character set.

Summary The entire purpose of a table is to provide structure for storing data within a relational database. A view is simply a virtual table consisting of different columns from one or more tables. Unlike a table, a view is stored in the database as a query object; therefore, a view is an object that obtains its data from one or more tables. A stored procedure is a previously written SQL statement which has been “stored” or saved into the database.