I didn’t find any answer how to select every point in multipoint data type in MySQL. I have multipoint that contains many points and I want to select every point by query and I can’t figure it out. …
SQL Count Number Of Classmates For a Student Across All Courses
I have the following tables: Student: Student_ID (PK), Student_Name Course: Course_ID (PK), Course_Name Enrollment: Student_ID (FK), Course_ID (FK) I need 2 queries: A query that computes for each student id in the Student table the total number of different (Unique) classmates that this student has across al…
Mersenne Primes processing
I took interest in Mersenne Primes https://www.mersenne.org/. Great Internet Mersenne Prime Search (GIMPS) is doing the research in this field. These are Prime Numbers but are very large and few. 49th Mersenne Prime is 22 million digits long. It is unbelievable that one number can be 22 million digits. I trie…
Sql select count use five condion
i count to some row form my database in five condition use the sql query it’s work with 0 if i put the number more than 0 then it not show any result. please help . it’s work with script $query33=…
ORA-01422: exact fetch returns more than requested number of rows )shows for a trigger
I have tired to create a trigger like this, but it shows this error Answer This error indicates that your query SELECT DNAME INTO DeptName … returns more than one record, hence its result cannot be assigned to a scalar variable. The problem with your query is that you have an unecessary JOIN on purchase…
MySQL query – addition, count and divide in one query
I have a table with column “Score”, which holds a number ranging from 1 to 10. I need to achieve the following calculation in MySQL: Column: Score Row 1: 10 Row 2: 9 Row 3: 9 Row 4: 7 Row 5: 10 …
GROUP_CONCAT to return an object array in a many to many relationship
I am working on a mySQL query for a personal project. Right now the end goal is to have the query return the following json for each item: My most recent attempt is: Which is giving me an internal server error. Testing it with a simplier query goes through fine so I’ve narrowed it down to the query itse…
Converting Varchar(200) to YYYY-MM-DD format in Teradata SQL
I have a Varchar like so: 23FEB2025 I am trying to convert it into a format like: 1994-02-23 or YYYY-MM-DD I have tried select cast (’23FEB2025′ as date format ‘yyyy-mm-dd’); and sel convert(date,’…
Tuning a query converting subquery
I was trying to change an update statement where there is a subquery in the WHERE clause to a join in order to improve performance. DDL to sample table/data CREATE TABLE [dbo].[Table1]( [pre_plan_id]…
DB2 query with multiple WITH AS cases not compiling
For some reason, I can’t get this query to perform as I’m getting an error: Token ( was not valid. Valid tokens: , FROM INTO. I’m running this in DB2 and I think this is occurring at either the very …