mysql - How can I uniquely Insert data into a table without using Unique/Primary key keyword in SQL? Is there any other way? -


i want insert data columns no data can inserted more once! no data of same type/category can same! know easier / best way use defining attribute unique / primary key ... there others ways this!

you can check data before inserting it, using group clause, or distinct or join. depends on requirement.

for example, if data identical , using distinct enough:

insert <yourtable> select distinct ... ... 

or directly check if data exists in table:

inset <yourtable> select .... table s not exists(select 1 yourtable t                  t.type = s.type , t.category = s.category) 

and on..


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -