DATABASE MANAGEMENT SYSTEMS PREPARED BY: ENGR. MOBEEN NAZAR
SCHEME OF PRESENTATION LAB MARKS DISTRIBUTION LAB FILE DBMS PROJECT INSTALLATION STEPS FOR SQL SERVER 2008 SETTING UP SQL SERVER 2008 INTRODUCTION TO SQL LAB#1
LAB MARKS DISTRIBUTION Lab Exam + Viva 20 DBMS Project + Report + Viva 30 Lab Activity (Assessment/Lab file/viva) 30 Lab Quiz 20 Total 100
LAB FILE Title Page,index,lab separater DBMS-BCE4.docx Title Page,index,lab separater DBMS-BSE4B.docx
LAB FILE
LAB FILE
INSTALLATION STEPS FOR SQL SERVER 2008 INSTALLATION STEPS FOR SQL SERVER 2008.pdf
SETTING UP SQL SERVER 2008 Setting up SQL Server 2008.pdf
What is a database? INTRODUCTION TO SQL A database is an organized collection of data. What is a Database Management System? Database management systems (DBMSs) are specially designed software applications that interact with the user, other applications, and the database itself to capture and analyze data. Well-known DBMSs include MySQL, MariaDB, PostgreSQL, SQLite, Microsoft SQL Server, Oracle, SAP, dbase, FoxPro, IBM DB2, LibreOffice Base and FileMaker Pro.
What is a Server? A server is a computer that serves information to other computers. These other computers are called clients. Connected through a local area network (LAN) or a wide area network (WAN), such as the Internet.
What is a Record? A complete set of information. Records are composed of fields. What is a field?
A space allocated for a particular item or information. A collection of fields is called a record.
We ll be working with three databases: 1- Northwind 2- Pubs 3-Adventureworks
What is SQL? SQL stands for Structured Query LanguageSQL lets you access and manipulate databases
SQL is an ANSI (American National Standards Institute) standard What Can SQL do? SQL can execute queries against a database SQL can retrieve data from a database SQL can insert records in a database SQL can update records in a database SQL can delete records from a database SQL can create new databases SQL can create new tables in a database SQL can create stored procedures in a database SQL can create views in a database SQL can set permissions on tables, procedures, and views
The SELECT... FROM Clause The most basic SELECT statement has only 2 parts: (1) the columns you want to display and (2) from the table(s) these columns belong to. SELECT EmployeeID, FirstName, LastName, HireDate, City FROM Employees If we want to retrieve all of the information about all of the customers in the Employees table, we could use the asterisk (*) as a shortcut for all of the columns, and our query looks like
SELECT * FROM Employees The WHERE Clause The next thing we want to do is to start limiting, or filtering, the data we fetch from the database. By adding a WHERE clause to the SELECT statement, we add one (or more) conditions that must be met by the selected data. SELECT EmployeeID, FirstName, LastName, HireDate, City FROM Employees WHERE City = 'London
Select EmployeeID from Employees where City='London' or City='Seattle'; SQL Aggregate Functions SQL aggregate functions return a single value, calculated from values in a column. Useful aggregate functions: AVG() - Returns the average value COUNT() - Returns the number of rows FIRST() - Returns the first value LAST() - Returns the last value MAX() - Returns the largest value MIN() - Returns the smallest value SUM() - Returns the sum
The COUNT() function The COUNT() function returns the number of rows that matches a specified criteria. SELECT COUNT(column_name) FROM table_name; Select COUNT(EmployeeID) from Employees; Select COUNT(EmployeeID) AS NumberOfEmployees from Employees;
SELECT DISTINCT Statement The SELECT DISTINCT statement is used to return only distinct (different) values. SELECT DISTINCT column_name,column_name FROM table_name; SELECT DISTINCT City FROM Customers;