Presentation is loading. Please wait.

Presentation is loading. Please wait.

# 1# 1 Moving SQL Data Across Applications How do you export and import data into or out of a database? What do we mean by.csv? CS 105 Spring 2010.

Similar presentations


Presentation on theme: "# 1# 1 Moving SQL Data Across Applications How do you export and import data into or out of a database? What do we mean by.csv? CS 105 Spring 2010."— Presentation transcript:

1 # 1# 1 Moving SQL Data Across Applications How do you export and import data into or out of a database? What do we mean by.csv? CS 105 Spring 2010

2

3 About moving data. First, a few definitions… The CSV (Comma delimited) file format – batting.csv Text files (ASCII) – pitching.txt HTML files – Batting.html CS 105 Spring 2010

4 Moving data into SQLyog from the Web Import data from author’s website: http://www.forta.com/books/0672321289/ Then use WinZip, and you have text scripts: CS 105 Spring 2010

5 First, run the “create tables” scripts Just paste them into a query CREATE TABLE Customers ( cust_idCHAR(10)NOT NULL, cust_nameCHAR(50)NOT NULL, cust_addressCHAR(50), cust_cityCHAR(50), cust_stateCHAR(5), cust_zipCHAR(10), cust_country CHAR(50), cust_contact CHAR(50), cust_emailCHAR(255) ); CS 105 Spring 2010

6 Then, select one table, and run its “populate” script… paste it into a query INSERT INTO Customers (cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email) VALUES ('1000000001', 'Village Toys', '200 Maple Lane', 'Detroit', 'MI', '44444', 'USA', 'John Smith', 'sales@villagetoys.com'); ‘etc. CS 105 Spring 2010

7 Transfer complete CS 105 Spring 2010

8 Moving data from SQLyog to Access Usually.csv files are the easiest way. Every piece of software has its own peculiarities—be flexible CS 105 Spring 2010

9 Choose.csv Data This action saves the data in a file (csv means comma-separated- values) CS 105 Spring 2010

10 What does it look like now? Each record is on its own line Commas separate each field in each record CS 105 Spring 2010

11 Importing the data into Access (or any other database) Most databases allow you to import raw files as long as there is something to delineate the columns. With Access, create a new database but do not enter any data. CS 105 Spring 2010

12 Choose type of data that you will import CS 105 Spring 2010

13 Access automatically creates the columns CS 105 Spring 2010

14 You tell the database what data types, constraints, names you want CS 105 Spring 2010

15 Now you are all set: CS 105 Spring 2010

16 To Summarize: How do you export and import data into or out of a database? What does.csv stand for? link to importing demo film CS 105 Spring 2010


Download ppt "# 1# 1 Moving SQL Data Across Applications How do you export and import data into or out of a database? What do we mean by.csv? CS 105 Spring 2010."

Similar presentations


Ads by Google