In this tutorial, you will learn, how to create a sample database in SQLite using the mobile dataset. Know how the test.db is created.

Following are the queries to create the tables

Table 1: Mobile_sales_details

Create table mobile_sales_details
(mobile_name text primary key,type text,price integer(10),
discount numeric,sold_count int,brand_name text,os_name text,
added_date date,sim_type text,primary_camera_pixel numeric)

Table 2: mobile_rating

Create table mobile_rating
(mobile_name text,star5 int,star4 int, star3 int,
star2 int, star1 int)

Table 3: brand_details

Create table brand_details
(brand_name text primary key,location_id int,
stated_year int,foreign key(location_id) references company_location

Table 4: company_location

Create table company_location
(location_id int primary key,country_name)

Table 5: country_codes

Create table country_codes
(country_name text,iso_code text,coutry_code text)

Download the csv files

Importing statement

Following are the queries to import data from .csv file to the respective tables.

sqlite> .separator ","
sqlite> .import mobile_sales.csv mobile_sales_details
sqlite> .import mobile_rating.csv mobile_rating
sqlite> .import mobile_brand.csv brand_details
sqlite> .import company_location.csv company_location
sqlite> .import country_codes.csv country_codes

update mobile_sales_details set discount=null  where discount=’’