Skip to content
Advertisement

Tag: mysql

Delete row if table exists SQL

I have a script that drops a load of tables using DROP TABLE IF EXISTS, this works. There is also a delete in this script to DELETE a row from another table that I do not manage. This table may or …

MySQL comparison with null value

I have a column called CODE in a MySQL table which can be NULL. Say I have some rows with CODE=’C’ which I want to ignore in my select result set. I can have either CODE=NULL or CODE!=’C’ in my result …

Difference between SQL JOIN and querying from two tables

What is the difference between the query and this one Answer There is a small difference in syntax, but both queries are doing a join on the P_Id fields of the respective tables. In your second example, this is an implicit join, which you are constraining in your WHERE clause to the P_Id fields of both tables. The join is

Search between two SQL tables?

I have two tables: student Columns first_name last_name teacher_accounts Columns fname lname I have an input form that takes the data entered into an input field, and passes it through the …

How to calculate the slope in SQL

I have some data in a sql database and I’d like to calculate the slope. The data has this layout: I’d like the final output to look like this by creating a new table using SQL: To complicate things, not all Keywords have 3 dates worth of data, some have only 2 for instance. The simpler the SQL the better

Sort by last name and first name

I have a small little problem. I am have a drop down list that displays all of our customers names. As of right now, the list is sorted by last name (A-Z). But for example, there are 250 people with the last name “Smith”. What I need is a way that the last name of each customer to stay the

Advertisement