Database Reference
In-Depth Information
investor_name
investor_category_list
investor_market
investor_country_code
investor_state_code
investor_region
investor_city
funding_round_permalink
funding_round_type
funding_round_code
funded_at
funded_month
funded_quarter
funded_year
raised_amount_usd
We can go a step further than just printing the column names. Besides the names of
the columns, it would be very useful to know what type of values each column con‐
tains. Examples of data types are a string of characters, a numerical value, or a date.
Assume that we have the following toy data set:
$ < data/datatypes.csv csvlook
|-----+--------+-------+----------+------------------+------------+----------|
| a | b | c | d | e | f | g |
|-----+--------+-------+----------+------------------+------------+----------|
| 2 | 0.0 | FALSE | "Yes!" | 2011-11-11 11:00 | 2012-09-08 | 12:34 |
| 42 | 3.1415 | TRUE | Oh, good | 2014-09-15 | 12/6/70 | 0:07 PM |
| 66 | | False | 2198 | | | |
|-----+--------+-------+----------+------------------+------------+----------|
We've already used csvsql in Chapter 5 to execute SQL queries directly on CSV data.
When no command-line arguments are passed, it generates the SQL statement that
would be needed if we were to insert this data into an actual database. We can use the
output also for ourselves to inspect what the inferred column types are:
csvsql data/datatypes.csv
CREATE TABLE datatypes (
a INTEGER NOT NULL,
b FLOAT,
c BOOLEAN NOT NULL,
d VARCHAR(8) NOT NULL,
e DATETIME,
f DATE,
g TIME,
CHECK (c IN (0, 1))
);
Table 7-1 provides an overview of what the various SQL data types mean. If a column
has the NOT NULL string printed after the data type, that column contains no miss‐
ing values in the data set.
Search WWH ::




Custom Search