I have a table with a column that I want to insert data into but not existing data.
To give an example I have a day column and a customer. The same customer cannot have the same date twice, so I have a customer named Karl and he is on monday. If I try to add Karl to monday, when he is already existing on monday, it should not do that. How do I do this? Assuming I am using JTextFields to type the name and day.
So far I got this to insert data which works (though without checking if it's already existing!)
s.executeQuery ("SELECT * FROM customer"); s.executeUpdate("INSERT INTO customer values ('"+name.getText()+"', '"+day.getText()+"')");
How do I check if what I type in name textField and day textField both exist in same row?
Thanks in advance