-3

I am working in local sqlite data base, Where i am getting master data from server in the form of json and the master data is inserted in one table(master table).Based on the entries from edittext, checking the entered data is present in master table or not. If presented in master data created another table(Table2) to insert entries with time and retrieving the inserted(table2) data and showing in listview(Checked data).as of now is working fine. Here my question is to get not checked data from master table and that data should insert in another table2 and show in list view (like not checked data).

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
kishore
  • 61
  • 5

1 Answers1

0

Assuming that you mean to get tables that do or do not contain CHECK constraints then :-

SELECT * FROM sqlite_master WHERE type = 'table'  AND (sql LIKE '% CHECK(%' OR sql LIKE '% CHECK %(%')

will retrieve tables with CHECK constraints, whilst

SELECT * FROM sqlite_master WHERE type = 'table' AND  ( sql NOT LIKE '% CHECK(%') AND (sql NOT LIKE '% CHECK %(%' )

will retrieve tables that do not have CHECK constraints.

e.g.

Using SELECT * FROM sqlite_master WHERE type = 'table' returns 59 rows from a database used for experimentation :-

enter image description here

Using SELECT * FROM sqlite_master WHERE type = 'table' AND (sql LIKE '% CHECK(%' OR sql LIKE '% CHECK %(%') returns 1 row :-

enter image description here

Using SELECT * FROM sqlite_master WHERE type = 'table' AND ( sql NOT LIKE '% CHECK(%') AND (sql NOT LIKE '% CHECK %(%' ) returns 58 rows :-

enter image description here

MikeT
  • 51,415
  • 16
  • 49
  • 68