Skip to content

How to give names to output tables?

I need to do a JOIN using two ouput-tables (these tables result from previous operations using other tables). I want to give them specific names to reference them. I’ve try ALIAS, AS, INTO, but nothing works. I am new in SQL and I’d really like some help here. My code is the following I’d li…

Compare the sums of 2 separate columns with an SQL Statement

I need help with the following code: Issue with the code: The resultant table contains only NULL in the delay fields. I’m unsure why this happens, as removing ArrivalsDelay and DeparturesDelay from the GROUP BY results in the SELECT failing, as I’ve not included ArrivalsDelay in the GROUP BY which…

How do you use mysql to only return a record if no conflicts exist?

Is there a way to have a SELECT statement only return a result if there exist no records in the database that conflict with the conditions? For example, people can reserve a table for two-hour blocks. A new reservation should only be allowed if there are no reservations that overlap with the new request. Some…

How to summarize multiple fields in sql

How can I V1,V2,V4,V5 already summarized data as v1,v2,v3,v4. How can I sum v1+v2 and v4+v5 and GTOT +———————————————————+ | Name | V1 | V2 | V1+V2 | V4 | V5 | V4+…

SQL PROCEDURES – Multi inserts

I’m trying to create SQL procedure that registers a user to the system. for that the user details need to save to a lot of tables, i make this procedure and its work but returns me an error: 14:47:53 …

How to handle repeated records in SQL?

I have a simple data set like below: Employee Data I need minimum start date & max end date of an employee whenever there is a dept id change or status code change. So i wrote this formula for Min …