SQLite Forum

Does table have rowid?
Login
How about:

```
select coalesce((select rowid == rowid from table where rowid is not null limit 1), 1);
```

which will return 1 if the table has an attribute accessible by the name `rowid` otherwise it will throw an error that the column does not exist.  This can be used to test for the existence of any accessible attribute of table ...

```
select coalesce((select schema == schema from pragma_table_xinfo where schema is not null limit 1), 1);
```

will return 1 because schema is a valid attribute (hidden column) of pragma_table_xinfo.