processing data with a database

Size: px
Start display at page:

Download "processing data with a database"

Transcription

1 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections MCS 507 Lecture 23 Mathematical, Statistical and Scientific Software Jan Verschelde, 19 October 2012 Scientific Software (MCS 507) processing data with a database 19 Oct / 39

2 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

3 MySQL & MySQLdb MySQL is an open source database, developed by the company MySQL AB. In February 2008, Sun Microsystems acquired MySQL AB and the expertise of the GPL software for $1 billion. In January 2010, Oracle acquired Sun for $7.38 billion. MySQL can be downloaded for free from Following the instructions, install MySQL first. MySQLdb is an interface to connect Python to MySQL. MySQLdb is an API (Application Programming Interface) to use Python scripts to work with MySQL databases. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

4 client/server computing MySQL is the M in LAMP: Linux Apache MySQL Python. your computer MySQL Client MySQL Server Server s disk Scientific Software (MCS 507) processing data with a database 19 Oct / 39

5 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

6 starting and stopping the daemon We will run MySQL as root on Linux or Mac OS X. Otherwise, management of users is needed. On Linux, login as root. On Mac OS X, use sudo. $ mysqld_safe Shutting the MySQL server down: $ mysqladmin shutdown On Mac OS X, put sudo in front of the commands. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

7 creating and deleting databases The command mysqladmin is used in MySQL for server administration. We need to use it to create first a database. On a Mac OS X, at the prompt $: $ mysqladmin create Book We have created a database with name Book. To delete the database Book: $ mysqladmin drop Book On Mac OS X, put sudo in front of the commands. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

8 MySQL to create the table Book $ mysqladmin create Library $ mysql... mysql> use Library Database changed mysql> create table Book -> (id INT, title CHAR(80), available SMALLINT) -> ; Query OK, 0 rows affected (0.08 sec) We created a table Book with attributes (1) id of domain INT; (2) title of domain CHAR, 80 wide; and (3) available of domain SMALLINT. With drop table Book; we remove the table. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

9 show and describe mysql> show tables; Tables_in_Library Book row in set (0.00 sec) mysql> describe Book; Field Type Null Key Default Extra id int(11) YES NULL title char(80) YES NULL available smallint(6) YES NULL rows in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

10 entering data mysql> insert into Book values -> (1,"primer on scientific programming",1); Query OK, 1 row affected (0.00 sec) mysql> select * from Book; id title available primer on scientific programming row in set (0.00 sec) mysql> select title from Book; title primer on scientific programming row in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

11 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

12 using MySQLdb in Python MySQLdb is an interface to use MySQL from within a Python session. As root or as sudo python: >>> import MySQLdb >>> L = MySQLdb.connect(db="Library") >>> c = L.cursor() Observe: run Python as superuser, otherwise no access; with connect(), we identify the database Library; L.cursor() returns a new object to represent a database cursor used to manage all operations. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

13 retrieving information Any command typed in a session with mysql can be passed as string to execute() on a cursor: >>> c.execute("show tables") 1L >>> c.fetchone() ( Book,) To show all records in the table Book: >>> c.execute("select * from Book") 1L >>> c.fetchall() ((1L, primer on scientific programming, 1),) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

14 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

15 GTFS of our CTA We can download the schedules of the CTA: GTFS = General Transit Feed Specification is an open format for packaging scheduled service data. A GTFS feed is a series of text files with data on lines separated by commas (csv format). Each file is a table in a relational database. We call our database CTA and will add tables reading the information from stops.txt. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

16 fields in stops.txt The first line in stops.txt lists: 1 stop_id: type INT 2 stop_code: type INT 3 stop_name: type CHAR(80) 4 stop_lat: type FLOAT 5 stop_lon: type FLOAT 6 location_type: type INT 7 parent_station: type INT 8 wheelchair_boarding: type SMALLINT Scientific Software (MCS 507) processing data with a database 19 Oct / 39

17 creating database and table $ mysqladmin create CTA Then we start mysql: mysql> use CTA; Database changed mysql> create table stops -> (id INT, code INT, name CHAR(80), -> lat FLOAT, lon FLOAT, tp INT, -> ps INT, wb SMALLINT); Query OK, 0 rows affected (0.37 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

18 describe mysql> describe stops; Field Type Null Key Default Extra id int(11) YES NULL code int(11) YES NULL name char(80) YES NULL lat float YES NULL lon float YES NULL tp int(11) YES NULL ps int(11) YES NULL wb smallint(6) YES NULL rows in set (0.01 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

19 manual insertion The first data line in stops.txt contains 1,1,"Jackson & Austin Terminal", , ,0,,1 mysql> insert into stops values -> (1,1,"Jackson & Austin Terminal", -> , ,0,0,1); Query OK, 1 row affected (0.00 sec) mysql> select name from stops where id = 1; name Jackson & Austin Terminal row in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

20 deleting rows To delete a row, given its id: mysql> delete from stops where id = 1; Query OK, 1 row affected (0.65 sec) mysql> select * from stops; Empty set (0.01 sec) If the where clause is omitted, then all rows in the table are deleted. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

21 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

22 filling a table Typing 12,165 is rather tedious... After filling the table stops of the database we query the table for a name: mysql> select name from stops where id = 3021; name California & Augusta row in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

23 the main program def main(): """ Opens the file with name filename, reads every line and insert the data into the table stops. """ L = MySQLdb.connect(db="CTA") c = L.cursor() print opening, filename,... file = open(filename, r ) # we skip the first line d = file.readline() while True: d = file.readline() if d == : break InsertData(c,d) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

24 inserting data def InsertData(c,s): """ Inserts the data in the comma separated string using the cursor c. """ L = s.split(, ) d = insert into stops values ( d = d + ( 0, if L[0] == else L[0] +, ) d = d + ( 0, if L[1] == else L[1] +, ) d = d + L[2] +, + L[3] +, + L[4] +, d = d + ( 0, if L[5] == else L[5] +, ) d = d + ( 0, if L[6] == else L[6] +, ) w = L[7]; L7 = w[0:len(w)-2] + ) d = d + ( 0) if L[7] == else L7) # print d c.execute(d) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

25 querying the table mysql> select id from stops -> where name = "California & Augusta"; id rows in set (0.00 sec) mysql> select name from stops where id = 17154; name California & Augusta row in set (0.01 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

26 querying with Python $ sudo python dbctastopquery.py give a stop id : has name California & Augusta $ sudo python dbctastopquery.py give a stop id : 0 0 has name None Scientific Software (MCS 507) processing data with a database 19 Oct / 39

27 the main program def main(): """ Connects to the database, prompts the user for a stop id and the queries the stops table. """ L = MySQLdb.connect(db="CTA") c = L.cursor() id = input( give a stop id : ) n = getstopname(c,id) print id, has name, n Scientific Software (MCS 507) processing data with a database 19 Oct / 39

28 executing the query def getstopname(c,id): """ Given a cursor c to the CTA database, queries the stops table for the stop id. Returns None if the stop id has not been found, otherwise returns the stop name. """ s = select name from stops w = where id = %d % id q = s + w r = c.execute(q) if r == 0: return None else: t = c.fetchone() return t[0] Scientific Software (MCS 507) processing data with a database 19 Oct / 39

29 processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed are tables in database filling a table with a Python script storing the connections Scientific Software (MCS 507) processing data with a database 19 Oct / 39

30 fields in stop_times.txt The first line in stop_times.txt lists: 1 trip_id: type INT 2 arrival_time: type TIME 3 departure_time: type TIME 4 stop_id: type INT 5 stop_sequence: type INT 6 stop_headsign: type VARCHAR(80) 7 pickup_type: type INT 8 shape_dist_traveled: type INT Scientific Software (MCS 507) processing data with a database 19 Oct / 39

31 adding a new table mysql> create table stop_times -> (id INT, arrival TIME, departure TIME, -> stop INT, seq INT, head VARCHAR(80), -> ptp INT, sdt INT); Query OK, 0 rows affected (0.37 sec) Note the types TIME and VARCHAR. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

32 describe mysql> describe stop_times; Field Type Null Key Default Extra id int(11) YES NULL arrival time YES NULL departure time YES NULL stop int(11) YES NULL seq int(11) YES NULL head varchar(80) YES NULL ptp int(11) YES NULL sdt int(11) YES NULL rows in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

33 manual insertion mysql> insert into stop_times values ( -> ,"12:09:14","12:09:14",6531,29, -> "Midway Orange Line",0,18625); Query OK, 1 row affected (0.00 sec) mysql> select departure, head from stop_times; departure head :09:14 Midway Orange Line row in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

34 filling the table On Mac OS X laptop: $ sudo python dbctafillstoptimes.py opening../lec22/cta/stop_times.txt... dbctafillstoptimes.py:26: Warning: Out of range value for column id at row 1 c.execute(d) Redo on a fast Linux Workstation: # time python dbctafillstoptimes.py opening../lec22/cta/stop_times.txt... dbctafillstoptimes.py:26: Warning: Out of range value for column id at row 1 c.execute(d) real 5m32.433s user 1m11.921s sys 0m17.735s Scientific Software (MCS 507) processing data with a database 19 Oct / 39

35 about the complexity While running dbctafillstoptimes.py, the memory consumption of Python and mysql was of the same magnitude, about 300Mb. mysql> select count(*) from stop_times; count(*) row in set (0.00 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

36 inserting data def InsertData(c,s): """ Inserts the data in the comma separated string using the cursor c. """ L = s.split(, ) d = insert into stop_times values ( d = d + ( 0, if L[0] == else L[0] +, ) d = d + \" + L[1] + \" +, d = d + \" + L[2] + \" +, d = d + L[3] +, + L[4] +, d = d + L[5] +, + L[6] +, w = L[7]; L7 = w[0:len(w)-2] + ) d = d + ( 0) if L[7] == else L7) # print d c.execute(d) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

37 querying stop_times mysql> select head from stop_times -> where stop = 3021 and -> arrival < "05:30:00"; head rd Pl/Kedzie 63rd Pl/Kedzie 63rd Pl/Kedzie 63rd Pl/Kedzie rows in set (0.94 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

38 an involved query mysql> select name, departure, head -> from stops, stop_times -> where stops.id = > and stops.id = stop_times.stop -> and stop_times.departure < "05:30:00"; name departure head California & Augusta 04:43:49 63rd Pl/Kedzie California & Augusta 05:03:49 63rd Pl/Kedzie California & Augusta 05:19:49 63rd Pl/Kedzie California & Augusta 05:12:49 63rd Pl/Kedzie rows in set (0.57 sec) Scientific Software (MCS 507) processing data with a database 19 Oct / 39

39 Summary + Exercises With Python scripts we read files into MySQL database. Visit 1 Install MySQL and MySQLdb on your computer. 2 Write a Python script to return the name of stop, given its id, using the table stops. 3 Design a GUI with Tkinter to query the stop name: one entry field for the stop id, another for the name of the stop, and one button in the middle to execute the query. Note that the GUI allows to query given the stop id or given the stop name. The fourth homework is due on Monday 22 October, 10AM: exercises 3 and 6 of Lecture 13; exercises 2 and 4 of Lecture 14; exercises 1 and 3 of Lecture 15; exercises 2 and 5 of Lecture 16; exercises 3 and 4 of Lecture 17. Scientific Software (MCS 507) processing data with a database 19 Oct / 39

processing data from the web

processing data from the web processing data from the web 1 CTA Tables general transit feed specification stop identification and name finding trips for a given stop 2 CTA Tables in MySQL files in GTFS feed are tables in database

More information

making connections general transit feed specification stop names and stop times storing the connections in a dictionary

making connections general transit feed specification stop names and stop times storing the connections in a dictionary making connections 1 CTA Tables general transit feed specification stop names and stop times storing the connections in a dictionary 2 CTA Schedules finding connections between stops sparse matrices in

More information

pygtfs Documentation Release Yaron de Leeuw

pygtfs Documentation Release Yaron de Leeuw pygtfs Documentation Release 0.1.2 Yaron de Leeuw January 26, 2014 Contents 1 Get it 1 2 Basic usage 3 3 gtfs2db 5 4 Detailed refernce 7 5 Contents: 9 5.1 The schedule module...........................................

More information

Field required - The field column must be included in your feed, and a value must be

Field required - The field column must be included in your feed, and a value must be This document explains the types of files that comprise a GTFS transit feed and defines the fields used in all of those files. 1. Term Definitions (#term-definitions) 2. Feed Files (#feed-files) 3. File

More information

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces User 1 2 MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September 2011 User 1 2 command line interfaces Many programs run without dialogue with user, as $ executable

More information

This lab will introduce you to MySQL. Begin by logging into the class web server via SSH Secure Shell Client

This lab will introduce you to MySQL. Begin by logging into the class web server via SSH Secure Shell Client Lab 2.0 - MySQL CISC3140, Fall 2011 DUE: Oct. 6th (Part 1 only) Part 1 1. Getting started This lab will introduce you to MySQL. Begin by logging into the class web server via SSH Secure Shell Client host

More information

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy User Interfaces 1 Command Line Interfaces getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy 2 Encapsulation by Object Oriented Programming

More information

Hands-on GTFS. Omaha, NE October 29, U.S. Department of Transportation Federal Transit Administration

Hands-on GTFS. Omaha, NE October 29, U.S. Department of Transportation Federal Transit Administration Hands-on GTFS Omaha, NE October 29, 2017 Presenters & Let s meet you! Marcy Jaffe Technical Support for GTFS Builder Toolkit Available by phone/email Amelia Bostic Greenway Public Transportation No experience

More information

Operating systems fundamentals - B07

Operating systems fundamentals - B07 Operating systems fundamentals - B07 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems fundamentals - B07 1 / 33 What is SQL? Structured Query Language Used

More information

Web Clients and Crawlers

Web Clients and Crawlers Web Clients and Crawlers 1 Web Clients alternatives to web browsers opening a web page and copying its content 2 Scanning Files looking for strings between double quotes parsing URLs for the server location

More information

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML Web Interfaces 1 Python Scripts in Browsers the web server Apache processing forms with Python scripts Python code to write HTML 2 Web Interfaces for the Determinant dynamic interactive forms passing data

More information

Package SIRItoGTFS. May 21, 2018

Package SIRItoGTFS. May 21, 2018 Package SIRItoGTFS May 21, 2018 Type Package Title Compare SIRI Datasets to GTFS Tables Version 0.2.4 Date 2018-05-21 Allows the user to compare SIRI (Service Interface for Real Time Information) data

More information

Web Interfaces for Database Servers

Web Interfaces for Database Servers Web Interfaces for Database Servers 1 CGI, MySQLdb, and Sockets glueing the connections with Python functions of the server: connect, count, and main development of the code for the client 2 Displaying

More information

Review for Second Midterm Exam

Review for Second Midterm Exam Review for Second Midterm Exam 1 Policies & Material 2 Questions modular design working with files object-oriented programming testing, exceptions, complexity GUI design and implementation MCS 260 Lecture

More information

LECTURE 21. Database Interfaces

LECTURE 21. Database Interfaces LECTURE 21 Database Interfaces DATABASES Commonly, Python applications will need to access a database of some sort. As you can imagine, not only is this easy to do in Python but there is a ton of support

More information

Creating Your First MySQL Database. Scott Seighman Sales Consultant Oracle

Creating Your First MySQL Database. Scott Seighman Sales Consultant Oracle Creating Your First MySQL Database Scott Seighman Sales Consultant Oracle Agenda Installation Review Accessing the MySQL Server > Command Line > GUI Tools/MySQL Workbench 5.2 Creating Your First Database

More information

Defining Functions. turning expressions into functions. writing a function definition defining and using modules

Defining Functions. turning expressions into functions. writing a function definition defining and using modules Defining Functions 1 Lambda Functions turning expressions into functions 2 Functions and Modules writing a function definition defining and using modules 3 Computing Series Developments exploring an example

More information

Linux Network Administration. MySQL COMP1071 Summer 2017

Linux Network Administration. MySQL COMP1071 Summer 2017 Linux Network Administration MySQL COMP1071 Summer 2017 Databases Database is a term used to describe a collection of structured data A database software package contains the tools used to store, access,

More information

More MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION

More MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION SESSION ELEVEN 11.1 Walkthrough examples More MySQL This session is designed to introduce you to some more advanced features of MySQL, including loading your own database. There are a few files you need

More information

Kaivos User Guide Getting a database account 2

Kaivos User Guide Getting a database account 2 Contents Kaivos User Guide 1 1. Getting a database account 2 2. MySQL client programs at CSC 2 2.1 Connecting your database..................................... 2 2.2 Setting default values for MySQL connection..........................

More information

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior Chapter 6 Introduction to SQL 6.1 What is a SQL? When would I use it? SQL stands for Structured Query Language. It is a language used mainly for talking to database servers. It s main feature divisions

More information

Assignment 6: SQL III Solution

Assignment 6: SQL III Solution Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III Solution This assignment

More information

EASYLAMP UBUNTU V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE

EASYLAMP UBUNTU V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE EASYLAMP UBUNTU V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE CONTENTS 1 Introduction... 2 2 Creating and configuring a virtual machine... 3 3 Installing Apache... 8 4 Installing MySQL...

More information

Midterm Exam II MCS 275 Programming Tools 14 March 2017

Midterm Exam II MCS 275 Programming Tools 14 March 2017 NAME: answers The exam is closed book, no notes and no computer. All your answers to the questions below must be submitted on paper. Write your name on this sheet and submit it with your answers. Please

More information

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements Welcome to MCS 360 1 About the Course content expectations 2 our first C++ program using g++ input and output streams the namespace std 3 Greatest Common Divisor Euclid s algorithm the while and do-while

More information

solving polynomial systems in the cloud with phc

solving polynomial systems in the cloud with phc solving polynomial systems in the cloud with phc Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu

More information

Bitnami MySQL for Huawei Enterprise Cloud

Bitnami MySQL for Huawei Enterprise Cloud Bitnami MySQL for Huawei Enterprise Cloud Description MySQL is a fast, reliable, scalable, and easy to use open-source relational database system. MySQL Server is intended for mission-critical, heavy-load

More information

EASYLAMP REDHAT V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE

EASYLAMP REDHAT V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE EASYLAMP REDHAT V1.0 DOCUMENT OWNER: OUDHUIS, JONATHAN INGRAM MICRO CLOUD EUROPE CONTENTS 1 Introduction... 2 2 Creating and configuring a virtual machine... 3 3 Installing Apache... 10 4 Installing MariaDB...

More information

Welcome to MCS 275. Course Content Prerequisites & Expectations. Scripting in Python from OOP to LAMP example: Factorization in Primes

Welcome to MCS 275. Course Content Prerequisites & Expectations. Scripting in Python from OOP to LAMP example: Factorization in Primes Welcome to MCS 275 1 About the Course Course Content Prerequisites & Expectations 2 Introduction to Programming Scripting in Python from OOP to LAMP example: Factorization in Primes 3 Summary MCS 275 Lecture

More information

Data Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018.

Data Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018. Data Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 4: SQL This assignment will

More information

CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University

CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University CS 377 Database Systems Database Programming in PHP Li Xiong Department of Mathematics and Computer Science Emory University Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP

More information

Assignment 6: SQL III

Assignment 6: SQL III Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III This assignment

More information

Advanced MySQL Query Tuning

Advanced MySQL Query Tuning Advanced MySQL Query Tuning Alexander Rubin August 6, 2014 About Me My name is Alexander Rubin Working with MySQL for over 10 years Started at MySQL AB, then Sun Microsystems, then Oracle (MySQL Consulting)

More information

Random Walks & Cellular Automata

Random Walks & Cellular Automata Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of

More information

Python Programming Exercises 1

Python Programming Exercises 1 Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them

More information

Bitnami MariaDB for Huawei Enterprise Cloud

Bitnami MariaDB for Huawei Enterprise Cloud Bitnami MariaDB for Huawei Enterprise Cloud First steps with the Bitnami MariaDB Stack Welcome to your new Bitnami application running on Huawei Enterprise Cloud! Here are a few questions (and answers!)

More information

callback, iterators, and generators

callback, iterators, and generators callback, iterators, and generators 1 Adding a Callback Function a function for Newton s method a function of the user to process results 2 A Newton Iterator defining a counter class refactoring the Newton

More information

How To Start Mysql Use Linux Command Line Client In Ubuntu

How To Start Mysql Use Linux Command Line Client In Ubuntu How To Start Mysql Use Linux Command Line Client In Ubuntu Getting started with MySQL for web and server applications on Ubuntu 14.04 LTS (Trusty Tahr). get started with MySQL on an Ubuntu 14.04 LTS (Trusty

More information

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists Lists and Loops 1 Lists in Python defining lists lists as queues and stacks inserting and removing membership and ordering lists 2 Loops in Python for and while loops the composite trapezoidal rule MCS

More information

List Comprehensions and Simulations

List Comprehensions and Simulations List Comprehensions and Simulations 1 List Comprehensions examples in the Python shell zipping, filtering, and reducing 2 Monte Carlo Simulations testing the normal distribution the Mean Time Between Failures

More information

Provider: MySQLAB Web page:

Provider: MySQLAB Web page: Provider: MySQLAB Web page: www.mysql.com Installation of MySQL. Installation of MySQL. Download the mysql-3.3.5-win.zip and mysql++-.7.--win3-vc++.zip files from the mysql.com site. Unzip mysql-3.3.5-win.zip

More information

Numerical Integration

Numerical Integration Numerical Integration 1 Functions using Functions functions as arguments of other functions the one-line if-else statement functions returning multiple values 2 Constructing Integration Rules with sympy

More information

Mysql Tutorial Show Table Like Name Not >>>CLICK HERE<<<

Mysql Tutorial Show Table Like Name Not >>>CLICK HERE<<< Mysql Tutorial Show Table Like Name Not SHOW TABLES LIKE '%shop%' And the command above is not working as Table name and next SHOW CREATE TABLEcommand user889349 Apr 18. If you do not want to see entire

More information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 SQL: Data De ni on Mar n Svoboda mar n.svoboda@fel.cvut.cz 13. 3. 2018 Czech Technical University

More information

Graphical User Interfaces

Graphical User Interfaces to visualize Graphical User Interfaces 1 2 to visualize MCS 507 Lecture 12 Mathematical, Statistical and Scientific Software Jan Verschelde, 19 September 2011 Graphical User Interfaces to visualize 1 2

More information

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin http://www.php-editors.com/articles/sql_phpmyadmin.php 1 of 8 Members Login User Name: Article: Learning SQL using phpmyadmin Password: Remember Me? register now! Main Menu PHP Tools PHP Help Request PHP

More information

MySQL Installation Guide (OS X)

MySQL Installation Guide (OS X) Step1- Install MySQL MySQL Installation Guide (OS X) Go to MySQL download page (http://dev.mysql.com/downloads/mysql/). Download the DMG archive version. Select the correct installer based on your system.

More information

Lab # 1. You will be using MySQL as a database management system during the labs. The goal of this first lab is to familiarize you with MySQL.

Lab # 1. You will be using MySQL as a database management system during the labs. The goal of this first lab is to familiarize you with MySQL. DDB Spring 2006 Lab # 1 You will be using MySQL as a database management system during the labs. The goal of this first lab is to familiarize you with MySQL. The reason you are using MySQL is twofolds.

More information

Hydra Installation Manual

Hydra Installation Manual Hydra Installation Manual Table of Contents 1. Introduction...1 2. Download...1 3. Configuration...1 4. Creating the Database...2 5. Importing WordNets...2 6. Known Issues...3 7. Detailed installation

More information

PYTHON MYSQL DATABASE ACCESS

PYTHON MYSQL DATABASE ACCESS PYTHON MYSQL DATABASE ACCESS http://www.tuto rialspo int.co m/pytho n/pytho n_database_access.htm Copyrig ht tutorialspoint.com T he Python standard for database interfaces is the Python DB-API. Most Python

More information

IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://www.certqueen.com

IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://www.certqueen.com IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://www.certqueen.com Exam : 005-002 Title : Certified MySQL 5.0 DBA Part I Version : Demo 1 / 10 1. Will the following SELECT query

More information

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 wrap Root Finding Methods 1 2 wrap MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 Root Finding Methods 1 wrap 2 wrap wrap octave-3.4.0:1> p = [1,0,2,-1]

More information

Getting Started with MySQL

Getting Started with MySQL A P P E N D I X B Getting Started with MySQL M ysql is probably the most popular open source database. It is available for Linux and you can download and install it on your Linux machine. The package is

More information

CS Programming Languages: Python

CS Programming Languages: Python CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer

More information

Branching and Enumeration

Branching and Enumeration Branching and Enumeration 1 Booleans and Branching computing logical expressions computing truth tables with Sage if, else, and elif 2 Timing Python Code try-except costs more than if-else 3 Recursive

More information

Data Analysis and Integration

Data Analysis and Integration MEIC 2015/2016 Data Analysis and Integration Lab 5: Working with databases 1 st semester Installing MySQL 1. Download MySQL Community Server for your operating system. For Windows, use one of the following

More information

Databases. Course October 23, 2018 Carsten Witt

Databases. Course October 23, 2018 Carsten Witt Databases Course 02807 October 23, 2018 Carsten Witt Databases Database = an organized collection of data, stored and accessed electronically (Wikipedia) Different principles for organization of data:

More information

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS 1 INTRODUCTION TO EASIK EASIK is a Java based development tool for database schemas based on EA sketches. EASIK allows graphical modeling of EA sketches and views. Sketches and their views can be converted

More information

How To Start Mysql Using Linux Command Line Client In Ubuntu

How To Start Mysql Using Linux Command Line Client In Ubuntu How To Start Mysql Using Linux Command Line Client In Ubuntu Step One: Install MySQL Client On Debian, Ubuntu or Linux Mint: Before you start typing commands at the MySQL prompt, remember that each In

More information

MySQL: an application

MySQL: an application Data Types and other stuff you should know in order to amaze and dazzle your friends at parties after you finally give up that dream of being a magician and stop making ridiculous balloon animals and begin

More information

Random Walks & Cellular Automata

Random Walks & Cellular Automata Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of

More information

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus Lecture #23: SQLite

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus  Lecture #23: SQLite CSCI-UA:0060-02 Database Design & Web Implementation Professor Evan Sandhaus sandhaus@cs.nyu.edu evan@nytimes.com Lecture #23: SQLite Database Design and Web Implementation Administrivia! Homework HW 8

More information

CSC 337. Relational Databases and SQL. Rick Mercer

CSC 337. Relational Databases and SQL. Rick Mercer CSC 337 Relational Databases and SQL Rick Mercer Relational databases Relational database: A method of structuring data as tables associated to each other by shared attributes A table row corresponds to

More information

CIS 192: Lecture 11 Databases (SQLite3)

CIS 192: Lecture 11 Databases (SQLite3) CIS 192: Lecture 11 Databases (SQLite3) Lili Dworkin University of Pennsylvania In-Class Quiz app = Flask( main ) @app.route('/') def home():... app.run() 1. type(app.run) 2. type(app.route( / )) Hint:

More information

MySQL Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP

MySQL Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP MySQL Guide Meher Krishna Patel Created on : Octorber, 2017 Last updated : December, 2017 More documents are freely available at PythonDSP Table of contents Table of contents i 1 MySQL overview 1 1.1 Basic

More information

Mysql Information Schema Update Time Null >>>CLICK HERE<<< doctrine:schema:update --dump-sql ALTER TABLE categorie

Mysql Information Schema Update Time Null >>>CLICK HERE<<< doctrine:schema:update --dump-sql ALTER TABLE categorie Mysql Information Schema Update Time Null I want to update a MySQL database schema (with MySQL code) but I am unfortunately not sure 'name' VARCHAR(64) NOT NULL 'password' VARCHAR(64) NOT NULL fieldname

More information

MySQL User Conference and Expo 2010 Optimizing Stored Routines

MySQL User Conference and Expo 2010 Optimizing Stored Routines MySQL User Conference and Expo 2010 Optimizing Stored Routines 1 Welcome, thanks for attending! Roland Bouman; Leiden, Netherlands Ex MySQL AB, Sun Microsystems Web and BI Developer Co-author of Pentaho

More information

Mastering Linux. Paul S. Wang. CRC Press. Taylor & Francis Group. Taylor & Francis Croup an informa business. A CHAPMAN St HALL BOOK

Mastering Linux. Paul S. Wang. CRC Press. Taylor & Francis Group. Taylor & Francis Croup an informa business. A CHAPMAN St HALL BOOK Mastering Linux Paul S. Wang CRC Press Taylor & Francis Group Boca Raton London New York CRC Press is an Imprint of the Taylor & Francis Croup an informa business A CHAPMAN St HALL BOOK Contents Preface

More information

Infotek Solutions Inc.

Infotek Solutions Inc. Infotek Solutions Inc. Read Data from Database and input in Flight Reservation login logout and add Check point in QTP: In this tutorial we will read data from mysql database and give the input to login

More information

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ]

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] s@lm@n Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] Oracle 1z0-882 : Practice Test Question No : 1 Consider the statements: Mysql> drop function

More information

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. Outline. How cookies work. Cookies in PHP. Sessions. Databases. Cookies. Sometimes it is useful to remember a client when it comes

More information

Assignment 5: SQL II Solution

Assignment 5: SQL II Solution Data Modelling and Databases Exercise dates: March 29/March 30, 2018 Ce Zhang, Gustavo Alonso Last update: April 12, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 5: SQL II Solution This assignment

More information

Flexible Engine. Startup Guide

Flexible Engine. Startup Guide Flexible Engine Startup Guide This guide presents the deployment of a web server accessible from the internet and its database, on the Flexible Engine platform 2017 Orange Business Services version July

More information

turning expressions into functions symbolic substitution, series, and lambdify

turning expressions into functions symbolic substitution, series, and lambdify Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where

More information

Tired of MySQL Making You Wait? Alexander Rubin, Principal Consultant, Percona Janis Griffin, Database Evangelist, SolarWinds

Tired of MySQL Making You Wait? Alexander Rubin, Principal Consultant, Percona Janis Griffin, Database Evangelist, SolarWinds Tired of MySQL Making You Wait? Alexander Rubin, Principal Consultant, Percona Janis Griffin, Database Evangelist, SolarWinds Who Am I? Senior DBA / Performance Evangelist for Solarwinds Janis.Griffin@solarwinds.com

More information

Exam. Question: Total Points: Score:

Exam. Question: Total Points: Score: FS 2016 Data Modelling and Databases Date: June 9, 2016 ETH Zurich Systems Group Prof. Gustavo Alonso Exam Name: Question: 1 2 3 4 5 6 7 8 9 10 11 Total Points: 15 20 15 10 10 15 10 15 10 10 20 150 Score:

More information

CS1 Lecture 2 Jan. 16, 2019

CS1 Lecture 2 Jan. 16, 2019 CS1 Lecture 2 Jan. 16, 2019 Contacting me/tas by email You may send questions/comments to me/tas by email. For discussion section issues, sent to TA and me For homework or other issues send to me (your

More information

Data Modelling and Databases Exercise dates: March 20/March 27, 2017 Ce Zhang, Gustavo Alonso Last update: February 17, 2018.

Data Modelling and Databases Exercise dates: March 20/March 27, 2017 Ce Zhang, Gustavo Alonso Last update: February 17, 2018. Data Modelling and Databases Exercise dates: March 20/March 27, 2017 Ce Zhang, Gustavo Alonso Last update: February 17, 2018 Spring Semester 2018 Head TA: Ingo Müller Datasets set-up This assignment will

More information

CS 327E Lecture 3. Shirley Cohen. February 1, 2016

CS 327E Lecture 3. Shirley Cohen. February 1, 2016 CS 327E Lecture 3 Shirley Cohen February 1, 2016 Agenda Announcements Homework for today Reading Quiz Concept Questions Homework for next time Announcements Class participation points Midterm #1 will take

More information

Database extensions for fun and profit. Andrew Dalke Andrew Dalke Scientific, AB Gothenburg, Sweden

Database extensions for fun and profit. Andrew Dalke Andrew Dalke Scientific, AB Gothenburg, Sweden Database extensions for fun and profit Andrew Dalke Andrew Dalke Scientific, AB Gothenburg, Sweden Set the Wayback Machine to 1997! Relational databases - strings and numbers - SQL - clients written in

More information

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28)   First Name: Last Name: NetID: CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) http://www.cs.cornell.edu/courses/cs1110/2016sp/labs/lab01/lab01.pdf First Name: Last Name: NetID: Goals. Learning a computer language is a lot like learning

More information

Chapter 1 An introduction to relational databases and SQL

Chapter 1 An introduction to relational databases and SQL Chapter 1 An introduction to relational databases and SQL Murach's MySQL, C1 2015, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge Identify the three main hardware components of a client/server

More information

How To Start Mysql Use Linux Command Line Windows 7

How To Start Mysql Use Linux Command Line Windows 7 How To Start Mysql Use Linux Command Line Windows 7 How can I check the number of active MySQL connections on Linux based system? You can Open the terminal App or login to the remote server using ssh:

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

CET W/32 MySQL support module

CET W/32 MySQL support module CET W/32 MySQL support module REVISIONS Revision Date Changes Changed by 0.1 02/17/03 First Draft GK 0.2 02/18/03 Proofread and made minor syntax editing RG 0.3 02/21/03 Extended list of supported BASIC

More information

itexamdump 최고이자최신인 IT 인증시험덤프 일년무료업데이트서비스제공

itexamdump 최고이자최신인 IT 인증시험덤프  일년무료업데이트서비스제공 itexamdump 최고이자최신인 IT 인증시험덤프 http://www.itexamdump.com 일년무료업데이트서비스제공 Exam : 1z1-882 Title : Oracle Certified Professional, MySQL 5.6 Developer Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-882

More information

IBM DB2 UDB V7.1 Family Fundamentals.

IBM DB2 UDB V7.1 Family Fundamentals. IBM 000-512 DB2 UDB V7.1 Family Fundamentals http://killexams.com/exam-detail/000-512 Answer: E QUESTION: 98 Given the following: A table containing a list of all seats on an airplane. A seat consists

More information

Database Programming with SQL 5-1 Conversion Functions. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Programming with SQL 5-1 Conversion Functions. Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Programming with SQL 5-1 Objectives This lesson covers the following objectives: Provide an example of an explicit data-type conversion and an implicit data-type conversion Explain why it is important,

More information

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object.

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object. 1 WHAT IS A DATABASE? A database is any organized collection of data that fulfills some purpose. As weather researchers, you will often have to access and evaluate large amounts of weather data, and this

More information

Building a 64-bit CentOS 7 Workstation using Oracle Virtual Box

Building a 64-bit CentOS 7 Workstation using Oracle Virtual Box Building a 64-bit CentOS 7 Workstation using Oracle Virtual Box jthomas Enterprises, 2016 Building a CentOS 7 Workstation using Oracle VirtualBox 1 Section 1 Before You Begin This section details the environment

More information

MySQL 5.0 Certification Study Guide

MySQL 5.0 Certification Study Guide MySQL 5.0 Certification Study Guide Paul DuBois, Stefan Hinz, and Carsten Pedersen MySQC Press 800 East 96th Street, Indianapolis, Indiana 46240 USA Table of Contents Introduction 1 About This Book 1 Sample

More information

Advanced MySQL Query Tuning

Advanced MySQL Query Tuning Advanced MySQL Query Tuning Alexander Rubin July 21, 2013 About Me My name is Alexander Rubin Working with MySQL for over 10 years Started at MySQL AB, then Sun Microsystems, then Oracle (MySQL Consulting)

More information

Mysql Server 4.1 Manually Windows 7 Start Service

Mysql Server 4.1 Manually Windows 7 Start Service Mysql Server 4.1 Manually Windows 7 Start Service If you are not running the MySQL server as a service, use mysqladmin to manually remove the previous installation and MySQL service (if the server If you

More information

EE221 Databases Practicals Manual

EE221 Databases Practicals Manual EE221 Databases Practicals Manual Lab 1 An Introduction to SQL Lab 2 Database Creation and Querying using SQL Assignment Data Analysis, Database Design, Implementation and Relation Normalisation School

More information

Testing Software with Pexpect

Testing Software with Pexpect Testing Software with Pexpect 1 Testing Computer Algebra Systems testing software preparing the test suite replacing print with assert statements 2 Automating Tests with Pexpect testing SymPy in Sage with

More information

Configuring the Oracle Network Environment. Copyright 2009, Oracle. All rights reserved.

Configuring the Oracle Network Environment. Copyright 2009, Oracle. All rights reserved. Configuring the Oracle Network Environment Objectives After completing this lesson, you should be able to: Use Enterprise Manager to: Create additional listeners Create Oracle Net Service aliases Configure

More information

Getting started with MySQL Proxy

Getting started with MySQL Proxy Getting started with MySQL Proxy Giuseppe Maxia QA Developer - MySQL AB Sofia - OpenFest 2007 Agenda Overview Some fun Injecting queries Filtering and rewriting queries Working with results Proxy for logging

More information

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 08 Tutorial 2, Part 2, Facebook API (Refer Slide Time: 00:12)

More information

Chapter 13 : Informatics Practices. Class XI ( As per CBSE Board) SQL Commands. New Syllabus Visit : python.mykvs.in for regular updates

Chapter 13 : Informatics Practices. Class XI ( As per CBSE Board) SQL Commands. New Syllabus Visit : python.mykvs.in for regular updates Chapter 13 : Informatics Practices Class XI ( As per CBSE Board) SQL Commands New Syllabus 2018-19 SQL SQL is an acronym of Structured Query Language.It is a standard language developed and used for accessing

More information