Skip to content

Instantly share code, notes, and snippets.

@vishalkurup
Last active April 17, 2016 00:23
Show Gist options
  • Save vishalkurup/5382389 to your computer and use it in GitHub Desktop.
Save vishalkurup/5382389 to your computer and use it in GitHub Desktop.
SQL code to generate the table and data we will use in our PHP json page. This data will be consumed in our iOS app. This is the companion code to my iOS Tutorial on loading data from an external database into a table view on YouTube. Youtube channel: www.youtube.com/vtkurup/
-- create table
CREATE TABLE cities
(
id INT PRIMARY KEY NOT NULL auto_increment,
cityName VARCHAR(255),
cityState VARCHAR(255),
cityPopulation int,
country VARCHAR(255)
);
-- Insert data into our table
INSERT INTO cities(cityName, cityState, cityPopulation, country)
VALUE ('London', 'London', 8173194, 'United Kingdom');
INSERT INTO cities(cityName, cityState, cityPopulation, country)
VALUE ('Bombay', 'Maharashtra', 12478447, 'India');
INSERT INTO cities(cityName, cityState, cityPopulation, country)
VALUE ('Kuala Lumpur', 'Federal Territory', 1627172, 'Malaysia');
INSERT INTO cities(cityName, cityState, cityPopulation, country)
VALUE ('New York', 'New York', 8336697, 'United States');
INSERT INTO cities(cityName, cityState, cityPopulation, country)
VALUE ('Berlin', 'Berlin', 3538652, 'Deutschland');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment