Here is the database description: Company(ID_comp, name) Trip(trip_no, id_comp, plane, town_from, town_to, time_out, time_in) Passenger(ID_psg, name) Pass_in_trip(trip_no, date, ID_psg, place) …
SQL Split Function and Ordering Issue?
I have the following Split function, When I write, This will give me, I need to maintain the order. Answer A simpler function: Sample usage: Or to return orders from a table ordered by input:
connect by clause in regex_substr
I cant get the understanding of this statement – not eveN after googling around pv_no_list :=’23,34,45,56′; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list, …
Handling Null in Greatest function in Oracle
I want to compare two dates from two columns and get the greatest and then compare against a date value. The two column can hold NULL values too. For example I want the below OUTPUT. How do I use the greatest function or if there is anything else? I am again using the output to compare against another date. A…
Fire a trigger after the update of specific columns in MySQL
In MySQL, I want to fire a trigger after the update of specific columns. I know how to do it in Oracle and DB2: CREATE TRIGGER myTrigger AFTER UPDATE of myColumn1,myColumn2 … ON myTable FOR EACH …
Insert multiple rows in one table based on number in another table
I am creating a database for the first time using Postgres 9.3 on MacOSX. Let’s say I have table A and B. A starts off as empty and B as filled. I would like the number of entries in column all_names in table B to equal the number for each names in table A like table B below. Thus names
Unpivot with column name
I have a table StudentMarks with columns Name, Maths, Science, English. Data is like I want to get it arranged like the following: With unpivot I am able to get Name, Marks properly, but not able to get the column name in the source table to the Subject column in the desired result set. How can I achieve this…
SELECT DISTINCT values and INSERT INTO table
I want to take a column with values that repeat multiple times and get that value only once and store it for later use, but at the same time I would like to get another value in the same row as that distinct column. A, B, C represent three columns. Ignore C for now. My question is: How can I
Why does the following join increase the query time significantly?
I have a star schema here and I am querying the fact table and would like to join one very small dimension table. I can’t really explain the following: EXPLAIN ANALYZE SELECT COUNT(impression_id), …
The provider did not return a ProviderManifestToken string Entity Framework
An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure …