1 / 19

DBMS and SQL

DBMS and SQL. Today’s Learning Objective. Know what a DBMS is Know why it is used Recognise a range of SQL statements Be able to create simple SQL statements. What is a Database. : “ An organised collection of related data that is stored and convenient to use and access”

sydneyj
Download Presentation

DBMS and SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DBMS and SQL

  2. Today’s Learning Objective • Know what a DBMS is • Know why it is used • Recognise a range of SQL statements • Be able to create simple SQL statements

  3. What is a Database : “An organised collection of related data that is stored and convenient to use and access” It contains data, (raw facts and figures) but because it is organised in a logical order the data becomes information that can be searched and used to create new information It consists of tables, forms, reports and queries

  4. What is a DBMS? DBMS: stands for Database Management System If you want to access a database form a web page, an app, you phone then it requires software that will organise the security, storing and retrieval of the data. A DBMS communicates between the database and the interface that the user sees User interactivity is achieved through use a command language (SQL)

  5. The DBMS sits between the database and the software application used to access the database User Application /software DBMS Database

  6. Separating data from applications The DBMS that the DBMS software sits between the database and the applications that run it. Why separate them? Separation is a strength because, • A webpage or application could be redesigned without the concern of redesigning the database • The database can be redesigned or modified without concern that the application has to be redesigned. • Other businesses or developers can create or customise their own DBMS for a database

  7. What can a DBMS do True or False • Create a new Database • Create new table, record • Update the database records and fields • Delete, the database, individual records, • Produce new data using queries and produce reports • Manage the security of the data

  8. DataBase Administrator • A Database Administrator has responsibility of managing and organising the database to ensure that it is in working order. • They have to ensure that the data is structured and organised in an appropriate manner to meet the needs of the users. • They also make sure that the database is backed up and that the data is kept secure through passwords and encryption

  9. True or False • DBMS means Data Based Management System • DBMS are Databases • A user can access the database through the DBMS • DBMS can be used to search for records in the database? • A DBMS can be changed without it editing the database? • A database administrator is responsible for the DBMS? • A database administrator is responsible for the security of the database • DBMS can be used to edit a database? • DBMS can be used to create graphs of the data

  10. True or False Answers • DBMS means Data Based Management System (F) • DBMS are Databases (F) • A user can access the database through the DBMS (T) • DBMS can be used to search for records in the database? (T) • A DBMS can be changed without it editing the database? (T) • A database administrator is responsible for the DBMS? (F) • A database administrator is responsible for the security of the database (T) • DBMS can be used to edit a database? (T) • DBMS can be used to create graphs of the data (F)

  11. SQL STATEMENTS • The DBMS application and the database need to communication with each other to allow the user to mange the database • SQL allows a user to control and send instructions to a database • SQL stands for Standard Query Language, it allows the application to speak to the database and organise and manage it • The next few slides will cover the statements to insert a record, delete a record and how to search for particular data and records

  12. SQL CREATE A NEW RECORD SQL allows the user to create a new record in the database via the DBMS INSERT INTO Customers VALUES (‘Sarah', ‘Jones', ‘UK') INSERT INTO Customers instructs the DMBS to Insert a new record into the customer table VALUES (‘Sarah', ‘Jones', ‘UK') tells the application the values Sarah Jones and UK are being added to the table

  13. SQL Delete If you want to delete a record you can use the delete command DELETE FROM Customers WHERECustomerName=‘Smith' ANDContactName=Jones‘ This would delete the records Smith and Jones

  14. SQL RETRIEVING RECORDS • This statement instructs the DBMS to select all the records from the customer table • SELECT * FROM Customers; • SELECT : Tells the program you want to select the records without changing them • * the star represents all the records • FROM Customers: this TELLS THE DBMS to select all the records from the customer table

  15. SQL WHERE • What if you want to find a particular piece of data from a particular field? • SELECT * FROM Customers WHERE Country=‘UK'; • Where = ‘UK’,: tells the database to only return THE records where the condition is met, the country is UK. • This would find and return all the customer records that have the Country listed as UK

  16. SQL AND QUERY • What if you want to find a particular piece of data from a field and data from another field? • SELECT * FROM CustomersWHERE Country= ‘UK'AND City=‘London'; • SELECT * FROM Customers means select all the records from the customer table • WHERE Country= ‘UK‘ select the records where the field country is UK • AND City=‘London';and the records where the City field is London

  17. SQL OR QUERY • When using the AND search criteria, SQL will return the records where, both field values are met. • To search for return records where the Country is UK OR the City is London. • SELECT * FROM CustomersWHERE Country= ‘UK'OR City=‘London'; • The OR statement returns records where either the Country is UK or the city is London

  18. GAME TIME PUT THESE IN THE CORRECT ORDER • FROM SELECT, *, Customers, Country= ‘UK‘, WHERE AND, City=‘London'; • SELECT, FROM, ‘0436726', BankDetails, *, WHERE, = ‘0234‘, OR, Account SortCode = WHICH STATEMENT IS USED TO SELECT ALL RECORDS?, SELECT ALL, SELECT * ALL, SELECT * FROM WHAT IS MISSING FROM THIS STATEMENT TO DELETE A RECORD? the Customers WHERE CustomerName=‘Smith' AND ContactName=Jones‘ DELETE, DELETE FROM, DELETE WHERE, DELETE WHEN, WHAT COMMAND DO YOU USE TO FIND A RECORD THAT CONTAINS EITHER ONE OR TWO PIECES OF DATA? OR, EITHER, ELSE, AND

  19. GAME TIME answers • SELECT, *, FROM, Customers, WHERE, Country= ‘UK‘, AND, City=‘London'; • SELECT, *, FROM, BankDetails, WHERE, Account= ‘0234‘, OR, SortCode =‘0436726', • SELECT * • DELETE FROM, • OR, EITHER, ELSE, AND

More Related