1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.

Slides:



Advertisements
Similar presentations
Session 2Introduction to Database Technology Data Types and Table Creation.
Advertisements

Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Introduction to Structured Query Language (SQL)
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
5 Chapter 5 Structured Query Language (SQL1) Revision.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Introduction to Structured Query Language (SQL)
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.
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
Concepts of Database Management Sixth Edition
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Database Lecture # 1 By Ubaid Ullah.
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
ASP.NET Programming with C# and SQL Server First Edition
1 INTRODUCTION TO DATABASE MANAGEMENT SYSTEM L E C T U R E
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Concepts of Database Management Seventh Edition
SQL FUNDAMENTALS SQL ( Structured Query Language )
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
Visual Programing SQL Overview Section 1.
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
Sql DDL queries CS 260 Database Systems.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
1 CS 430 Database Theory Winter 2005 Lecture 10: Introduction to SQL.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Unit-8 Introduction Of MySql. Types of table in PHP MySQL supports various of table types or storage engines to allow you to optimize your database. The.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
SQL Basics Review Reviewing what we’ve learned so far…….
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Understanding Core Database Concepts Lesson 1. Objectives.
3 A Guide to MySQL.
Aga Private computer Institute Prepared by: Srwa Mohammad
Creating Database Objects
CS 3630 Database Design and Implementation
Data Definition and Data Types
ORACLE SQL Developer & SQLPLUS Statements
Accounting System Design
Accounting System Design
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Understanding Core Database Concepts
Creating Database Objects
SQL (Structured Query Language)
Presentation transcript:

1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Session 9 Designing a Database (Hands-On) ITE 252 Database Management

2 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Understanding Core Database Concepts Lesson 1

3 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Database A database (db) is an organized collection of data, typically stored in electronic format. – It allows you to input data, organize the data and retrieve the data quickly. – Traditional databases are organized by fields, records, and files.

4 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Database Files Microsoft SQL server uses three types of files to store the database: – Primary data files, with an.mdf extension, which contain user-defined objects, such as tables and views, as well as system tables. – Secondary data files, with an.ndf extension, on separate physical hard disks to give your database more room. – Transaction log files use an.ldf extension and don’t contain any objects such as tables or views.

5 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Database Management System (DBMS) Most users do not access the databases directly, Instead, users use a database management system (DBMS) to access the databases indirectly. DBMS is a collection of programs that enables you to enter, organize, and select data in a database.

6 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Database Servers Databases are often found on database servers so that they can be accessed by multiple users and to provide a high-level of performance. A popular database server is Microsoft SQL Server.

7 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Constraints Constraints are limitations or rules placed on a field or column to ensure that data that is considered invalid is not entered.

8 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. SQL Server Management Studio (SSMS) The central feature of SSMS is the Object Explorer, which allows the user to browse, select and manage any of the objects within the server.

9 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. SQL Server Management Studio (SSMS)

10 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Data Manipulation Language (DML) Data Manipulation Language (DML) is the language element which allows you to use the core statements: – SELECT: Retrieves rows from the database and enables the selection of one or many rows or columns from one or many tables in SQL Server. – INSERT: Adds one or more new rows to a table or a view in SQL Server. – UPDATE: Changes existing data in one or more columns in a table or view. – DELETE: Removes rows from a table or view. – MERGE: Performs insert, update, or delete operations on a target table based on the results of a join with a source table.

11 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Data Definition Language (DDL) Data Definition Language (DDL) is a subset of the Transact-SQL language. It deals with creating database objects like tables, constraints, and stored procedures. Some DDL commands include: – USE: Changes the database context. – CREATE: Creates a SQL Server database object (table, view or stored procedure) – ALTER: Changes an existing object – DROP: Removes an object from the database

12 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. System Tables System views belong to the sys schema. Some of these system tables include: – sys.Tables – sys.Columns – sys.Databases – sys.Constraints – sys.Views – sys.Procedures – sys.Indexes – sys.Triggers – sys.Objects

13 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Creating Database Objects Lesson 2

14 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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

15 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

16 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

17 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Data Types

18 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

19 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

20 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

21 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

22 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

23 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. 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.

24 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Third Normal Form (See figure 4-31 in text; notice DEPARTMENT table)

25 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Homework HW#2: In HW#1 you created an E-R diagram modeled after the Good Reading Bookstores E-R diagram (Figure 3-19 in your text and slide 14 here) for a publisher of music (limit to MP3s). Now apply the normalization technique for all three forms, building tables similar to Figure 4-30 and 4-31 in your text on pages Due next Monday (try to use Blackboard)