Creating a Database Microsoft SQL Server. Create Database SQL Management Studio 1.In Object Explorer, connect to an instance of the SQL Server Database.

Slides:



Advertisements
Similar presentations
Microsoft Access.
Advertisements

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Microsoft SQL Server 2008 From the Program menu choose: Microsoft SQL Server 2008 R2  SQL Server Management Studio. You may see a window indicating the.
Customizing Reports. Custom Reports A report is a formatted hardcopy of the contents of one or more tables from a database. Although you can format and.
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
Access Lesson 2 Creating a Database
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Access Tutorial 1 Creating a Database
DT211 Stage 2 Databases Lab 1. Get to know SQL Server SQL server has 2 parts: –A client, running on your machine, in the lab. You access the database.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
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.
Using ERWin to model your data Supplied by Computer Associates as part of AllFusion.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ 1 Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Access Tutorial 10 Automating Tasks with Macros
Advanced Tables Lesson 9. Objectives Creating a Custom Table When a table template doesn’t suit your needs, you can create a custom table in Design view.
Backup & restore database. Backup a database Step 1.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Working with Queries in Microsoft Access The Access Workbench: Section Three DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
Create Database Tables
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Creating a Web Site to Gather Data and Conduct Research.
Company LOGO 1 Database Creation and Maintenance Jorge G. Martinez.
Basic SQL Commands examples from Beginning MySQL by Robert Sheldon & Geoff Moes.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Switchboards, PivotTables, and PivotCharts.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
ISM 4212 Lab Creating DB Tables 02 copyright Lars Paul Linden 2007.
Key Applications Module Lesson 21 — Access Essentials
Screen ViewModule Title: Notes: Branching Instructions: Audio Script: Page: Messaging Configure the Address Book 1 Configure the Personal Address Book.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Access Project 7 Advanced Report and Form Techniques.
® Microsoft Office 2013 Access Creating a Database.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Unit 5 Microsoft SQL Server and MySQL. Key Concepts DBMS variations SQL Server features SQL Server Management Studio MySQL features Scripts Queries Database.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Creating an Application System Using Macros, Wizards, and the Switchboard.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Ch. 101 Database Management An Introduction to Databases.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
Instructor: Craig Duckett Lecture 12: Tuesday, May 19, 2015 Intro to SQL Server, SSMS 1.
1 After completing this lesson, you will be able to: Get around the Internet with your browser. Connect to the Internet. Print Web pages. Save Web pages.
IMS 4212 Lab: Lab Introduction 1 Dr. Lawrence West, MIS Dept., University of Central Florida Subject—Topics Installing.
Modify Tables and FieldsModify Tables and Fields Lesson 4 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Word Microsoft.
Database EssentialsDatabase Essentials Lesson 1 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Word Microsoft Access.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
SQL server Section 2&3. What are Data Types Character Data Types Number Data Types Date and Time Data Types CAST and CONVERT functions TRY_PARSE and TRY_CONVERT.
Ch 3. Working with Tables and Views. Data type Specify type of data to be entered into a column (text, number, datetime, etc) Unicode (National) Datatypes.
Chapter 28. Copyright 2003, Paradigm Publishing Inc. CHAPTER 28 BACKNEXTEND 28-2 LINKS TO OBJECTIVES Table Calculations Table Properties Fields in a Table.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
SQL Server 2012 Session: 1 Session: 6 Creating and Managing Databases Data Management Using Microsoft SQL Server.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
COMPUTER SKILLS MS-ACCESS. Introduction Access is a piece of software known as a database management system. At its most basic level, it can be used to.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Creating Data Base & Sql Data Source
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Access Creating a Database
Access Creating a Database
Microsoft Office Access 2003
Creating Data Base & Sql Data Source
Defining the Fields in a Table
Step 1:. Open Microsoft FrontPage application.
Presentation transcript:

Creating a Database Microsoft SQL Server

Create Database SQL Management Studio 1.In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance. 2.Right-click Databases, and then click New Database. 3.In New Database, enter a database name. 4.To create the database by accepting all default values, click OK; otherwise, continue with the following optional steps. 5.To change the owner name, click (…) to select another owner. 6.To change the default values of the primary data and transaction log files, in the Database files grid, click the appropriate cell and enter the new value. For more information, see Add Data or Log Files to a Database.Add Data or Log Files to a Database 7.To change the collation of the database, select the Options page, and then select a collation from the list. 8.To change the recovery model, select the Options page and select a recovery model from the list. 9.To change database options, select the Options page, and then modify the database options. For a description of each option, see Setting Database Options.Setting Database Options 10.To add a new filegroup, click the Filegroups page. Click Add and then enter the values for the filegroup. 11.To add an extended property to the database, select the Extended Properties page. 1.In the Name column, enter a name for the extended property. 2.In the Value column, enter the extended property text. For example, enter one or more statements that describe the database. 12.To create the database, click OK. Ref:

Create Database T-SQL USE master ; GO CREATE DATABASE Sales ON ( NAME = Sales_dat, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\saledat.mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5 ) LOG ON ( NAME = Sales_log, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\salelog.ldf', SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB ) ; GO Ref:

Create Table SQL Management Studio 1.Right-click the database in which you want the table to appear. A menu is shown. Select "New Table" from the list of menu items.database 2.Type column names on the left side of the table viewer. The table view is the place where you add your column names and data types. 3.Select a data type for each column. The data type is a drop-down menu item 4.Right-click one of the columns that is unique to the table and select "Primary Key." 5.Click the "Save" button on the SQL Server Management Studio toolbar. A window pops up asking for a table name. Enter it into the text box and press the "Ok" button. The table is created and saved in your database.SQL Ref:

Create Table T-SQL CREATE TABLE Names (FirstName VARCHAR (20), LastName VARCHAR (20) NOT NULL, DateOfBirth DATETIME, CONSTRAINT MultiConstraint UNIQUE(FirstName, LastName, DateOfBirth)); Ref:

Create Tables Exercise 1.Create a database named demo1 2.Use the SQL statements on the following slides to create and populate the Books, Authors, and AuthorBook tables. 3.Provide any corrections required for T-SQL syntax.

Create Books Table CREATE TABLE Books ( BookID SMALLINT NOT NULL PRIMARY KEY, BookTitle VARCHAR(60) NOT NULL, Copyright YEAR NOT NULL );

Insert data into Books INSERT INTO Books VALUES (12786, 'Letters to a Young Poet', 1934), (13331, 'Winesburg, Ohio', 1919), (14356, 'Hell\'s Angels', 1966), (15729, 'Black Elk Speaks', 1932), (16284, 'Noncomformity', 1996), (17695, 'A Confederacy of Dunces', 1980), (19264, 'Postcards', 1992), (19354, 'The Shipping News', 1993);

Create Authors Table CREATE TABLE Authors ( AuthID SMALLINT NOT NULL PRIMARY KEY, AuthFN VARCHAR(20), AuthMN VARCHAR(20), AuthLN VARCHAR(20) );

Insert data into Authors INSERT INTO Authors VALUES (1006, 'Hunter', 'S.', 'Thompson'), (1007, 'Joyce', 'Carol', 'Oates'), (1008, 'Black', NULL, 'Elk'), (1009, 'Rainer', 'Maria', 'Rilke'), (1010, 'John', 'Kennedy', 'Toole'), (1011, 'John', 'G.', 'Neihardt'), (1012, 'Annie', NULL, 'Proulx'), (1013, 'Alan', NULL, 'Watts'), (1014, 'Nelson', NULL, 'Algren');

Create AuthorBook Table CREATE TABLE AuthorBook ( AuthID SMALLINT NOT NULL, BookID SMALLINT NOT NULL, PRIMARY KEY (AuthID, BookID), FOREIGN KEY (AuthID) REFERENCES Authors (AuthID), FOREIGN KEY (BookID) REFERENCES Books (BookID) );

Insert Data into AuthorBook INSERT INTO AuthorBook VALUES (1006, 14356), (1008, 15729), (1009, 12786), (1010, 17695), (1011, 15729), (1012, 19264), (1012, 19354), (1014, 16284);

Basic Join SELECT BookTitle, Copyright, Authors.AuthID FROM Books, AuthorBook, Authors WHERE Books.BookID=AuthorBook.BookID AND AuthorBook.AuthID=Authors.AuthID ORDER BY Books.BookTitle;

Basic Join SELECT BookTitle, Copyright, Authors.AuthID FROM Books, AuthorBook, Authors ORDER BY BookTitle; What happens when we leave off the WHERE clause?

Basic Join SELECT BookTitle, Copyright, AuthID FROM Books AS b, AuthorBook AS ab WHERE b.BookID=ab.BookID ORDER BY BookTitle;