Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get all databases and their tables without primary key mysql

select tab.table_schema as database_name,
       tab.table_name
from information_schema.tables tab
left join information_schema.table_constraints tco
          on tab.table_schema = tco.table_schema
          and tab.table_name = tco.table_name
          and tco.constraint_type = 'PRIMARY KEY'
where tco.constraint_type is null
      and tab.table_schema not in('mysql', 'information_schema', 
                                  'performance_schema', 'sys')
      and tab.table_type = 'BASE TABLE'
--      and tab.table_schema = 'sakila' -- put schema name here
order by tab.table_schema,
         tab.table_name;
Comment

get all databases and their tables without primary key mysql

select tab.table_schema as database_name,
       tab.table_name
from information_schema.tables tab
left join information_schema.table_constraints tco
          on tab.table_schema = tco.table_schema
          and tab.table_name = tco.table_name
          and tco.constraint_type = 'PRIMARY KEY'
where tco.constraint_type is null
      and tab.table_schema not in('mysql', 'information_schema', 
                                  'performance_schema', 'sys')
      and tab.table_type = 'BASE TABLE'
--      and tab.table_schema = 'sakila' -- put schema name here
order by tab.table_schema,
         tab.table_name;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql user set plugin 
Sql :: ceil upto 2 decimal place mysql 
Sql :: sql server query field names 
Sql :: get create sql of hibernqte entity 
Sql :: systemverilog unique constraint unique values 
Sql :: sqlcl format 
Sql :: modify xml in sql server 
Sql :: join creating duplicate columns sqllite 
Sql :: pagination with row_number 
Sql :: turnicate in mysql 
Sql :: amount to words oracle Function 
Sql :: copy row from db to db mysql 
Sql :: pgsql sum switch case 
Sql :: sql insert into only auto id 
Sql :: intellij idea add mysql connector 
Sql :: get all employees if name ends with in sql 
Sql :: how to make oppointment table in database 
Sql :: Laravel SQLSTATE[HY093] with array query 
Sql :: Create a username nd password in MySql 
Sql :: how many columns can be used for creating index? 
Sql :: Postgres: Update Boolean column with false if column contains null 
Sql :: export partttion and import in oracle 
Sql :: dasebase_url-postgres for windows 
Sql :: stored procedure replace 
Sql :: ring MySQL execute a query on the database then print the result. 
Sql :: oracle date winter time 
Sql :: mysql password reset 
Sql :: mysql make date from 2 column 
Sql :: mysql database hyphen 
Sql :: add sql file to seeder 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =