Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does WebSQL support primary keys?

I'm creating a WebSQL table in Chrome with the following statement:

'CREATE TABLE IF NOT EXISTS recs(id, fname,lname,email,country,comments, synced     integer,PRIMARY KEY(id))'

Inserting records does not appear to be creating primary keys. How should one go about creating unique keys in webSQL?

like image 267
Fred Avatar asked Nov 14 '25 18:11

Fred


1 Answers

Use the unique keyword and check for the constraint error to verify.

'CREATE TABLE IF NOT EXISTS recs (id unique, fname, lname)'
like image 156
Paul Sweatte Avatar answered Nov 17 '25 10:11

Paul Sweatte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!