sql Questions

7

Solved

Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM sys.databases WHERE [name] = 'QAudit') CREATE DATABASE [QAudit] ON PRIMARY ( NAME = N'QAuditData', FILENAM...
Tenorite asked 9/9, 2009 at 4:39

4

Solved

I want to align a column in my table. In this case 'Title' mysql> SELECT Titel, KuenstlerName from Bild; +--------------------------+---------------+ | Title | Artist| +------------------------...
Awash asked 2/7, 2014 at 7:40

3

Solved

I have a function like so - CREATE OR REPLACE FUNCTION ind (bucket text) RETURNS table ( middle character varying (100), last character varying (100) ) AS $body$ BEGIN return query select f...
Wickedness asked 9/9, 2019 at 22:13

2

Solved

I have a database dump in thisdb_2022.dump binary file that I'm trying to import to dbeaver, but I haven't found a way to import the database so I can see it. I found the below in the dbeaver forum...
Backlash asked 3/2, 2022 at 15:55

6

Solved

I have a table similar to the one shown. It contains a list of user ids, the hour value for each hour of the day and an Avail flag to determine if that user is available on that hour. I need to li...
Viniculture asked 5/8, 2015 at 16:10

1

Can we in SQL (preferably Postgresql) mimic the pandas function pivot_table? For example, let's say we have a table with the following 3 columns: Name Day Value John Sunday 6 John Monday 3 John...
Euphonious asked 16/11, 2021 at 17:28

5

Solved

Let's say I have stored a bunch of holidays in my database. What I need to do is find out which is next work day excluding Saturdays and the public holidays defined in the database. eg. Let's sa...
Stertorous asked 9/2, 2012 at 9:20

2

Can I rely on Snowflake's lazy evaluation for testing and exception throwing? Are CTEs lazily evaluated? Is this documented? (related question: Assertions in Snowflake)

2

Solved

I have to use SQLPLUS for my database class, and our first assignment is simple saving. I followed the instructions.. (I'm using PuTTY to access sqlplus) "Use the following SQL commands in this e...
Krill asked 23/1, 2012 at 2:16

5

Solved

I have a (syntactically-valid, not-huge) CSV file. I want to run an arbitrary SQL SELECT query on it; let's assume that it can be a complex query, with some inner queries, with self-joins, maybe wi...
Nagle asked 22/8, 2023 at 13:48

10

Solved

SELECT N, CASE WHEN P IS NULL THEN 'Root' WHEN(SELECT COUNT(*) FROM BST WHERE P = b.N) > 0 THEN 'Inner' ELSE 'Leaf' END FROM bst b ORDER BY N;` Can anyone please explain this solution of hack...
Disallow asked 17/1, 2021 at 11:1

3

I am getting this error when i try to drop a memory optimized table. i am using a sql server 2016 sp1 Database and server triggers on DDL statements CREATE, ALTER and DROP are not supported with m...
Semiyearly asked 15/2, 2017 at 21:47

3

I have a native postgresql query (opts - jsonb array): select * from table users jsonb_exists_any(opts, ARRAY['CASH', 'CARD']); it works fine in my database console and I'm getting a result: user1...
Rainbow asked 16/5, 2021 at 23:51

6

Solved

Query should output a certain list of Items, along with info like store information and manager info. Uses a Cursor to flip through list of various different levels of management, selects relevant ...
Scrapbook asked 19/6, 2014 at 18:7

6

Solved

I have a column of type TIMESTAMP_NTZ and it contains timestamp that I know are on UTC timezone. Mainly I want to convert to TIMESTAMP_TZ because I have other columns that are TIMESTAMP_TZ and I wa...
Tevere asked 24/10, 2019 at 13:0

2

I have a table storing directory paths (Dirs). These directory rows are referenced by a Files table, using the directory's rowid as a foreign key. When re-indexing directories/files there is the ne...
Brandibrandice asked 8/3, 2020 at 0:29

2

Solved

I am using Snowflake database and ran this query to find total count, number of distinct records and difference: select (select count(*) from mytable) as total_count, (select count(*) from (se...
Lipscomb asked 21/5, 2019 at 22:37

3

Solved

I am trying to do a cohort analysis and compare average number of rentals based on the renter's first rental year(= the year where a renter rented first time). Basically, I am asking the question: ...
Petronia asked 24/5, 2016 at 15:34

4

Solved

If I have a table with an auto-incrementing ID column, I'd like to be able to insert a row into that table, and get the ID of the row I just created. I know that generally, StackOverflow questions ...
Clementeclementi asked 18/12, 2018 at 17:8

3

With Peewee I'm trying to use limit as follows: one_ticket = Ticket.select().limit(1) print one_ticket.count() This prints out 5 however. Does anybody know what's wrong here?
Ironmonger asked 19/11, 2013 at 9:6

1

I would like to ask for help :) Two INSERT statements are issued simultaneously by 2 users into a doctrine-generated many-to-many table: INSERT INTO my_table (col1, col2) VALUES (2271885, 16678); &...
Radferd asked 22/4, 2022 at 11:8

7

Solved

If I have two tables: Actor: ID | Name 1 : Patrick 3 : Emma 7 : Vanessa Singer: ID | Name 4 : Will 5 : Madonna 13 : Emma Can I generate the following table from an SQL query, which contains the...
sql
Microreader asked 8/10, 2009 at 12:59

4

Solved

I have been using DBeaver as a replacement for SQL Server Management Studio, and I am loving it. The only thing I cannot figure out is how to associate a script with a database. For example, in SSM...
Clouded asked 26/7, 2019 at 19:24

5

Solved

An associate has created a schema that uses an ENUM() column for the primary key on a lookup table. The table turns a product code "FB" into it's name "Foo Bar". This primary key is then used as a...
Celanese asked 16/2, 2009 at 3:2

2

Solved

I have the name of an index that is existing on some table on some column in the db(oracle 11g). Knowing the name of the index, how can i find which table it belongs to?
Eschatology asked 22/10, 2011 at 16:30

© 2022 - 2024 — McMap. All rights reserved.