Working with Databases. There are many different databases that one can use e.g. MS Access, Microsoft Sequel Server, MySQL. For our purposes, we will.

Slides:



Advertisements
Similar presentations
Connect to Excel Spreadsheet with an OLE DB Connection.
Advertisements

Logon then turn your monitor off! Creating a database A way of keeping information.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 2 Structured Query Language.
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
Overview Importing text files Creating Forms Creating Reports.
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.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
MYSQL and SQLite in Android Apps Mike Freedman. Uses Ability for your app to store new data and receive it later – Game Scores – Contact information –
Multiple Cases Access Utilities1 Access & ODBC Managing and Using ODBC Connections P.O. Box 6142 Laguna Niguel, CA
1 DATABASES & DATABASE MANAGEMENT SYSTEMS (DBMS). MS ACCESS What is a database Database terms DB constructing stages DB models Relational model Normal.
? Back Next INTRO. ? Back Next INTRO Main Menu What is Mail Merge? Slide 2 Purpose of Mail Merge Slide 3 Mail Merging Certificates Slide 5 Help Slide.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
Dbwebsites 2.1 Making Database backed Websites Session 2 The SQL… Where do we put the data?
Eurotrace Hands-On The Eurotrace File System. 2 The Eurotrace file system Under MS ACCESS EUROTRACE generates several different files when you create.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
JaeHwan Nam Module 3 Microsoft Word. 1. Self registration yourselves online. See read only folder on Student P Drive 2. Understand Mail Merge 3. Rage.
Software. Records Fields Each record is made up of fields – categories of information. The fields here are Name, Surname, Address, Telephone and Date.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Session 8: Databases Teaching Computing to GCSE Level with Python.
Copyright 2008 Judith A Copeland - Accessing The Database By Judi Copeland.
Paul Mundy Microsoft FrontPage Tips and tricks.
10.11 Data Manipulation 1. Getting External Data.
Present :Arezoo Mollahasani. Step 1  Define your server connection Open MySQL WorkBench and click New Server Instance on the right of the window.
MySQL Database Connection
1 A Guide to SQL Chapter 2. 2 Introduction Mid-1970s: SQL developed under the name SEQUEL at IBM by San Jose research facilities to be the data manipulation.
MySQL Database Management Systems Universitas Muhammadiyah Surakarta Yogiek Indra Kurniawan.
This is the first screen you will encounter. Select Blank Database.
By… Prapasri Fungsriwirot Database Training Division Book Promotion & Service Co., Ltd Latest Update 13/01/50.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
Instructions.  Open up the letter that Adam has given to you  Format it so it look professional.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Ch. 101 Database Management An Introduction to Databases.
Creating and Populating a MS SQLServer Database Presented By: Dr. Adam P. Anthony.
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql,
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
Document Control Template Editors Brad Adamczyk Template Editor Bands Bands create document layout Header, data, footer Order not critical.
1 CPE 332 Introduction DBMS: Relational Database Managment Systems Instructor:Suthep Madarasmi, Ph.D. ดร. สุเทพ มาดารัศมี
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
This is the software we will use to load our html page up to the server. You can download a copy for home if you want to.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Introduction to Database Programming with Python Gary Stewart
How To Start a SQL server Connecting to SQL Server.
Test1 Here some text. Text 2 More text.
3 A Guide to MySQL.
Aga Private computer Institute Prepared by: Srwa Mohammad
DB Programming – Basic analysis
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Creating Data Base & Sql Data Source
Displaying a Data Table
sqlite3 — DB-API 2.0 interface for SQLite databases
the first card insert text here.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Structured Query Language (SQL) William Klingelsmith
Working with Big Data in SQL
قـواعــــد الـبـيــانــات
[type text here] [type text here] [type text here] [type text here]
Your text here Your text here Your text here Your text here Your text here Pooky.Pandas.
Your text here Your text here Your text here Your text here
Computer Science Projects Database Theory / Prototypes
Creating Data Base & Sql Data Source
[type text here] [type text here] [type text here] [type text here]
Step 1:. Open Microsoft FrontPage application.
Fall
2 Hours Minutes Seconds Insert Text Here.
Presentation transcript:

Working with Databases

There are many different databases that one can use e.g. MS Access, Microsoft Sequel Server, MySQL. For our purposes, we will use a lightweight database called SQLite3. We can import the SQLite3 library as follows… import sqlite3 We can now use the database.

Next, we use the inbuilt function connect() to open a connection between our python program and the SQLite database. Import the SQLite3 library as follows… import sqlite3 MyDB =sqlite3.connect (‘NinjaTurtle.db’) Note!! We have used a RELATIVE file path here. This means the SQLite DB will be located in the same folder as your Python Program Note!! Name your database here…call it whatever you want!!!

MyDB =sqlite3.connect (‘N:\\Computing\\NinjaTurtle.db’) Note!! Make sure you have no spaces in your file path! Note!! Name your database here…call it whatever you want!!! If you want to go for ABSOLUTE file path…then here is an example

1.Sqlite library imported – ok 2.Connection to database – ok 3. Next, we need to create a cursor object (this will allow us to work with and manipulate our database) import sqlite3 MyDB = sqlite3.connect (‘N:\\ MyDocuments...etc’) c =MyDB.cursor() Now we can create our first table of data!

We use DDL (Data Definition Language) to create a table in SQlite. import sqlite3 MyDB = sqlite3.connect (‘N:\\ MyDocuments...etc’) c =MyDB.cursor() #create a table of students c.execute ('''CREATE TABLE Student (StudentID text, Firstname text, Surname text, DOB date, FormGroup text) ''')

The standard DDL for creating a table in SQLite is: #create a table example c.execute ('''CREATE TABLE NameOfTable (Field Data type, Field Data type, Field Data type) ''')

Now, to insert data into our new table called Student #insert data into our table c.execute (''‘INSERT INTO Student VALUES (‘001’,’Mary’,’Berry’,’1/1/1994’,’11W’) ‘’’) Make sure you are inserting data in the right order and with an appropriate data type.

Now you need to save changes using the COMMIT() function and close using the close() function #insert data into our table c.execute (''‘INSERT INTO Student VALUES (‘001’,’Mary’,’Berry’,’1/1/1994’,’11W’) ’’’) #Save changes using the commit() function MyDB.commit() #Close the database connection MyDB.close()