I have a Hive table named customer, which has a column named cust_id of list type, with following values: cust_id Now I want to read only this specific column cust_id in my select query, which can give all these list values as following separate values of this column cust_id: Basically I want to fetch all the values of cust_id from
Tag: database
What are the disadvantages when I use mutually dependent foreign keys?
I know that it’s not a good method to use two tables with mutual foreign key definitions, but I don’t understand the difficulties that arise in the database. An example: I’ve a table city and a table state. City.city points at state.capitalcity and state.state points at city.state. I would appreciate any help, thanks. Answer That’s fine. The problem arises when
Query BETWEEN TWO TABLES OUTPUT (MYSQL)
two table EMPLOYEE and Department EMPLOYEE’s fields are ID,Name, Salary ,DEPT_ID(foreign key to department table) DEPARTMENT’S fields are id,NAME,LOCATION VALUES OF EMPLOYEE TABLE WILL Be Values OF DEPARTMENT TABLE WILL BE Output from these table should be DEPARTMENT_Name should be alpabetically within their count If are there same Count DEPARTMENT_Name should appear in alpabetically and count will be desc order
NEWID function causing error for prepared statement in MYSQL
I am trying to create a forgot password system, so I am using the NEWID() function to create a random code to be sent to the user’s email. I am using prepared statements to prevent SQL injections, but this still isn’t working: I am getting a warning on line two that the first parameter can’t be a boolean. (Thus, there
Cannot figure out writing a compound SQLquery to the Oracle database
Please help me sort out the request: Develop a query to calculate the number of news, written by each author and the most popular tag, referred to author news. All these information must be output in one single result set. I wrote the first part of the request, it displays the amount of news for each author: Please tell me
How to implement the like and share feature for a social networking website? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I want to understand how the like button is actually implemented in a Web App (the database table part). How
SQL Query giving wrong output
I have written this code to find “For each year, count the number of movies in that year that had only female actors”. WITH k AS …
Comparing count(*) with select for one result
I have a table tb_xyz having field1, field2 as indexed. Now I have two queries: and Assuming both queries are written to just check if this condition is met at least once. Which of them is more optimal. I tried checking for their execution times, but results were mixed, for small data. Answer The first query (SELECT … LIMIT 1)
Query based on some data multiple compare
Table: How do i bring the period when customers have max cc_limit? If the cc_limits same for customer for more than one month, take the period with highest year-month data Answer Use row_number() window function,Below should work. EDIT : To clarify why order by should be in the inline view. Scenario : When there are duplicate records for same cc_limit
SQL bring number of count, another column basis problem [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I have this table: BANK – BRANCH_NAME – ADDRESS – DISTRICT – CITY – PHONE – FAX – OPENNING DATE How do I bring branches