Does sqlite3 support alter table add primary key?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Does sqlite3 support alter table add primary key?

Peng Yu
Hi,

I got the following error. Does sqlite3 support alter table add primary key?

sqlite> alter table mytab add primary key (h1);
Error: near "primary": syntax error

https://www.tutorialspoint.com/sqlite/sqlite_primary_key.htm

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Does sqlite3 support alter table add primary key?

David Raymond
Nope.

Here's the doc page with what SQLite supports: https://www.sqlite.org/lang.html
And here's the alter table page: https://www.sqlite.org/lang_altertable.html


-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Peng Yu
Sent: Wednesday, April 10, 2019 8:11 AM
To: SQLite mailing list
Subject: [sqlite] Does sqlite3 support alter table add primary key?

Hi,

I got the following error. Does sqlite3 support alter table add primary key?

sqlite> alter table mytab add primary key (h1);
Error: near "primary": syntax error

https://www.tutorialspoint.com/sqlite/sqlite_primary_key.htm

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Does sqlite3 support alter table add primary key?

Shawn Wagner
In reply to this post by Peng Yu
I don't think I've ever seen a decent sqlite page on tutorialspoint. Some,
like this one, appear to have been written by people who have never
actually used it.

On Wed, Apr 10, 2019, 5:11 AM Peng Yu <[hidden email]> wrote:

> Hi,
>
> I got the following error. Does sqlite3 support alter table add primary
> key?
>
> sqlite> alter table mytab add primary key (h1);
> Error: near "primary": syntax error
>
> https://www.tutorialspoint.com/sqlite/sqlite_primary_key.htm
>
> --
> Regards,
> Peng
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Does sqlite3 support alter table add primary key?

Keith Medcalf
In reply to this post by Peng Yu

CREATE UNIQUE INDEX <someuniquename> on H1 (...the unique columns...).

Primary key is (except for the INTEGER PRIMARY KEY in a rowid table) and in WITHOUT ROWID tables where it is the key of the b-tree, just semantic sugar for a UNIQUE index ...

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of Peng Yu
>Sent: Wednesday, 10 April, 2019 06:11
>To: SQLite mailing list
>Subject: [sqlite] Does sqlite3 support alter table add primary key?
>
>Hi,
>
>I got the following error. Does sqlite3 support alter table add
>primary key?
>
>sqlite> alter table mytab add primary key (h1);
>Error: near "primary": syntax error
>
>https://www.tutorialspoint.com/sqlite/sqlite_primary_key.htm
>
>--
>Regards,
>Peng
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users