I am trying to return a table location (path) using a SQL query (in my Python code). Is it possible? I’m using Hive and the data is stored in hdfs. I found this snippet of code elsewhere: But unfortunately I don’t understand it, so I don’t even know how to customise it to my problem. I want …
Tag: sql
How to convert date format in SQL Query Results?
I want to display Date fields in SQL Query Results as DD-MM-YYYY Format. In table it is vice versa. When I try with below query it does not works. SQL Query Link: (Tables can be retrieved by clicking …
Access add new SQL data
I would like to add some Data in my SQL table… Thats the actual build. – table User (Saves Useraccess data with column UserId, UserForename,UserSurname, Mail) – Formular add new User My formular has 3 TextFields for UserForename, UserSurname, Mail and a button for adding the details. By clic…
How to select two values in one row?
Seems extremely basic, but I can’t find an elegant solution to it. I have two SQL tables, say one contains the users, and the other one, the cities. A third table contains the matches between the two …
Get aggregated average values joining three tables and display them next to each value in first table
I have three tables which you can also find in the SQL fiddle: CREATE TABLE Sales ( Product_ID VARCHAR(255), Sales_Value VARCHAR(255), Sales_Quantity VARCHAR(255) ); INSERT INTO Sales (…
Query to select between two dates without year
I am trying to update certain fields for employees whose date of joining falls in between 10 Jun and 31 Dec, irrespective of the year. I am trying using ‘Between’ Operator but it requires year to be included in the dates. Is there a way to generalise it in order to consider Day and Month excluding…
SQL sum grouped by field with all rows
I have this table: I want this result: I tried this: But get the error that subquery returns different number of rows. How can I do it? I want all the rows of sale_lines table selecting all fields and adding the sum(price) grouped by sale_id. Answer You can use window function : If you want sub-query then you…
Displaying student absent dates
Here is the table I want to display: Now I want to search by from to date and want absent date. How can I achieve this? I tried below code: i want date for which student absend Answer Basically what you need is list of possible dates between From and To
mySQL Self Join – inner join or join
quick clarification. When joining contents from the same table, must I always declare join type as INNER? For example, (on the table shown in this screenshot) When I tried to remove the keyword INNER, it was wrong. Is it because JOIN does not exist in SQL? Thanks and cheers. Answer You do want a self (inner) …
Get aggregated average values joining a second table and display them next to each value in first table
I have two tables which you can also find in the SQL fiddle: The first table contains the Sales for each product. The second table contains the Categories. Now, I want to display all products and the average_sales_price_per_category next to each product. The result should look like this: I tried to go with th…