Basics of WAMP and SQL

Begin by installing WAMP on your local machine. [Video Tutorial]

Next you will bring the data you’ve scraped and cleaned, or if you’re lucky, acquired as a database ready table (for more on this see Data Preparation).

Begin by creating a new database.

new database

Next you will import your table by browsing to select the file from your computer.

import table_

Upon import, be sure to specify whether or not you have a header and if you want a primary key created.

import table header row check box

If you forget to check this box your table will have the header as the first row.

Box checked

Box unchecked

 

Box checked

Box checked

If you forget to add the primary key, you have to enter it into the database using this SQL command:

ALTER TABLE users ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST – where ‘users’ is replaced by the table name in your database. In this example we’re working on ‘table 3’ of the “coolplacesindy” database.

SQL entered into command box

SQL entered into command box

You will get a congratulations if you are successful:

After running SQL command

After running SQL command

In the before and after screenshots of the table, you’ll notice that the primary key has been added and editing features have been enabled.

Box checked

No Primary Key

checked header on import_with primary key

Primary Key labeled “id”

 

If you forget to import the header, or your table didn’t have a header, you could manually rename the column headers as in this example. It is much simpler to just re-import the table and ensure the “header as first row” box is checked, so the steps below are intended to begin showing how to edit a table using SQL.

 

Leave a Reply Text

Your email address will not be published. Required fields are marked *

Powered by WishList Member - Membership Software