My question is -> Retrieve the segment ID and length of each segment that is longer than the average length of all segments. Name the column indicating the length of segments “Length”. Relations: What I got so far is: And I got this error message: Error: Your query has syntax errors. Descriptio…
Copying Data from one SQL Server Database to Another SQL Database on a Daily basis
I am trying to figure out what would be the best way to copy SQL database views from one database to another. Both databases are hosted on two different servers, so will require firewall access between them. I will need to send the views of the data on a daily basis to the required database. Copy table to a d…
Get the highest category while performing other type of aggregates
Story: I am trying to get the sum of records and the max date by country and games and another column that would rank the top countries based on the sum of records: It is the country rank column that is giving me trouble. Here’s what I tried: All it does is rank the each row partition by country which
Multiple WHEN in CASE only applies first two
I have a CASE with 4 WHENs. The first two applie fine, but the last two (or any others I add past that) do not get applied. All WHENs are referring to the same field. Here’s what I’m trying to do. The field in question is formatted as: So it would look like The first Case I wrote was to
How to transform a BigQuery table into a list of row sequences where sequences are aggregated by a sliding window in time?
I have a very large table where each row represents an abstraction called a Trip. Trips consist of numeric columns such as vehicle id, trip id, start time, stop time, distance traveled, driving duration, etc. I want to transform this table into a list of Trip sequences where Trips are grouped into sequences b…
Window functions + self join to solve?
I want to display how many days an item was in each stage. We have many items, so just showing one ID for now for simplicity. For first stage it should be action_date -created time. For last stage it …
SQL function delete rows with a specific date and a specific value on another column
I have a question, mostly about syntax. I have a sql table and I need to delete some rows based on the date on a “Date” column as long as they contain a string in a “Client” column My issue is the …
Uncaught mysqli_sql_exception: You have an error in your SQL syntax
I cant get my update button to work, my SQL syntax isnt targeting the datebase properly, this is the syntax im using $sql = (“UPDATE crud SET name=’$name’, last=’$last’, email=’$email’, birthday=’$…
SQL (Oracle) – Select where record does not exist or another column in the 2nd table is true
Applications-Table ——————— ID FIRST_NAME LAST_NAME APPLICATION_TYPE STATUS_TYPE 123 JOHN SMITH EDUCATION …
How to insert rows in SQLite using default values?
Update: Here is what I have learned from the answers below… SQLite supports defining default values on columns. However, it does not support any form of DEFAULT keyword or function in queries. So, …