I have installed DB Browser for SQLite on my mac. I need to create a SQLITE database or use an existing database and create a table in the database called "Ages":
CREATE TABLE Ages (
name VARCHAR(128),
age INTEGER
)
So far I managed to create a table that looks like this:
CREATE TABLE Ages (
name VARCHAR(128)INTEGER,
age INTEGER
)
How do I get rid of the first "INTEGER", so my table looks like the one intended please?
You code use the Execute SQL tab and then use:-
This would leave the Ages_old table (which you may want to DROP). It would also cope with the Ages table containing actual data (the INSERT SQL copies the data from the renamed original table to the newly created table).
However, there is no real need as the columns could contain any type of data, this being a flexibility feature of SQLite (albeit confusing to some).
In fact as the column type varchar(128)integer contains int the column type affinity will be INTEGER anyway (again not that it really matters).
Perhaps consider this demo (executed using DBBrowser):-
table name is funny/weird but is to all intents and purposes ? (enclosed to allow an otherwise unacceptable name)
col x is, as the type if read implies, a weird/stupid.unconventional type
col y is an INTEGER type
col z is very close to the type you appear to have (enclosed to allow it)
the INSERT SQL inserts data for all 3 columns for 5 rows
the SELECT SQL extracts the data asis (i.e. all 3 columns) BUT adds another 3 columns that are the column type of the data for the row for the 3 columns.
When run then DBBrowser shows:-
You may wish to refer to https://sqlite.org/datatype3.html