Skip to content
Advertisement

Create table with composite attribute/columns in sqlite3

I have to create a Table in the SQLite database, however, I am unable to find the syntax where I can define composite attribute/columns while creating the table.In this ER diagram, I have a composite attribute as a DateOfPurchase of the Bicycle

So could some please help me with this, Thanks in advance.

Advertisement

Answer

See here: the last added field is a composite one with the 2 action fields !

  db = new sqlite3.Database('./event.db');

db.run(“INSERT OR IGNORE INTO logTable (logfile, logdate, referto, area, status, action) VALUES (?,?,?,?,?,?)”, [entry[“logfile”], entry[“logdate”], entry[“referto”], entry[“area”], entry[“status”], entry[“action”]+entry[“action2”]], function(err) { if (err) { return console.log(err.message); } else { db.close(); }

Its not while creating the tabel. It uses a existing field action

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement