Skip to content
Advertisement

Tag: database

UDF JavaScript implementation into Snowflake

I found usefull JS function that I want to implement into snowflake’s UDF in order to move complex computation to the dwh. http://trentrichardson.com/2010/04/06/compute-linear-regressions-in-javascript/ Attempt to rework above as SQL procedure: Execution fails with error: SQL compilation error: Invalid identifier which is odd since procedure has been created. Answer You’re almost there. To pass an array, try using ARRAY_CONSTRUCT or PARSE_JSON,

Taking same column but different values from database in C#

I am trying to get top 3 safety data row according to equipment and plant selection from database. Now I could get top 3 safety value from database with equipment and plant selection and insert to textbox. When I wrote “‘ or Safety ‘” + textbox.text + it is getting other plant and equipment selections Answer Keep your sql been

Query table with compound primary keys

I’m using pyodbc to connect to a machine database, and query a number of tables in that database using pandas.read_sql(tbl,cnxn), where tbl = “SELECT * FROM TABLE”, cnxn is pyodbc.connect(‘DSN=DATASOURCE;UID=USERID;PWD=PASSWORD’). It works on most tables, but some tables return: DatabaseError: Execution failed on sql ‘SELECT * FROM TABLE’: (’42S02′, ‘[42S02] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00942: table or view does not exist

How the db model should be for this scenario? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question I’m modeling a database scenario but I’m not understanding properly how to achieve that. The scenario is a user that can

MySQL Group by with named columns from grouped data

I’m writing an application to record 10 pin bowling game results. I’ve done the submission bit but I’m stuck on displaying the results. Here is the structure: In the example above I am assuming each person played 3 games, however any number of games could be played. How can I get the data in a more friendly format? For example:

Postgres Counts based on Month and Years

I have a psql table I want to get a break down of users points that shows their points the current month, current year, and the lifetime. I’m a bit lost on how to do this. What would the query look like? The final table should look like this Answer How about conditional aggregation?

How to merge columns and transpose in SQL?

I’m working with a custom DBMS (compliant with SQL 2011 Standard), and am trying to combine multiple columns into a single column like so, but am struggling with the syntax: Current table: Desired query output: I’ve tried various IF and CASE statements, but have hit a wall. Any help would be appreciated. Answer You can unpivot with union all: This

Advertisement