Skip to content
Advertisement

SQL statement to get all customers with no orders

I have a typical Persons table and an Orders table defined in such a way that I can do JOIN query as the following to return Orders for all Persons. The question is, how do I write a statement that would return all Persons with NO Orders? I’m using mysql. Thank all in advance. Answer You may want to use

Convert INT to DATETIME (SQL)

I am trying to convert a date to datetime but am getting errors. The datatype I’m converting from is (float,null) and I’d like to convert it to DATETIME. The first line of this code works fine, but I get this error on the second line: Arithmetic overflow error converting expression to data type datetime. Answer you need to convert to

Ideal database for geo (map) data

I’m looking for suggestions for an ideal database or data structure for storing a map. Essentially, the map consists of “ways” which are like roads, paths, etc. Ways contain nodes (which have a latitude and longitude coordinate, and sometimes an altitude.) Any such database or structure: should be able to locate all the nodes in a bounding box quickly (milliseconds)

SQL query for multiple tag inclusion

I´m net very good in explaining this. But i do my best: I’ve made a tagging tool for people. Some people contains more then 1 tag, and i need to get those but dont know how to write the SQL query for multiple tag inclusion. I know you can’t write WHERE conditions like this: LOWER( peoples_tags.tag_id ) = ‘outside’ AND

Count number of users from a certain country

I have a table of users, and in this table I have a country field telling where these people are from (i.e. “Sweden”, “Italy”, …). How can I do a SQL query to get something like: Users select their countries from a list I give to them, but the list is really huge so it would be great to have

Advertisement