Using Select with a function on 3d Table

From the following 3d-Table

t1={{{1, 1}, {2, 1}, {3, 4/3}}, {{1, 0}, {2, 1/2}, {3, 1}}, {{1, -1}, {2, 0}, {3, 2/3}}} 

I want to use Select for getting all pairs where the second Part is an Integer. So that I would get

{{{1, 1}, {2, 1}}, {{1, 0}, {3, 1}}, {{1, -1}, {2, 0}}} 

I can do it by

Pick[t1, Map[IntegerQ /@ #[[All, 2]] &, t1]] 

But there should be more elegant ways to do it. How to use Select or Select with Function or some other twist?

cannot select engines on left since update

since the recent update which i just updated to 14.75
i cannot select the engines on the left (when the engines are showing) & cannot right click on engines on left (i.e. to select just dofollow engines)
the engines on the left only show when you restart gsa ser, other wise there is just a blank space on the left where the engines should be, it says “where to submit 343” but below that just a blank space, this is just since the lest update

Is there a better way of displaying ‘Count’ of records beside other columns in a select query?

I have a table with below structure :

Test1(c_num  number ,c_first_name varchar2(50), c_last_name varchar2(50)) 

1)There is a normal index on c_num column.

2)The table has nearly 5 million records.

I have a procedure as you can see below. I want to display the Count(*) along with other columns.I want to know if there are better ways of doing this so that we can have better performance.

create or replace procedure get_members(o_result out sys_refcursor)    is begin  open o_result for   select c_num,          c_first_name,          c_last_name,          (select count(*) from test1) members_cnt -->Is there a better way instead of doing this?   from test1;  end; 

Thanks in advance

Beyond unauthorized data access, what security considerations should I have regarding a user-facing language based on SQL SELECT statements?

I’m considering making a new language based on SQL SELECT statements to allow users to export CSV data in the manner they please. I’m confident in being able to interface this with a permissions system by inspecting the resulting AST from parsing before turning it into a SELECT statement to execute, so I’m not really concerned about this leading to unauthorized data access.

This language would be pretty much a 1-to-1 mapping of SQL SELECT statements, except for a few changes regarding joins and a few other things.

Users are relatively few and can be easily traced and contacted. It’s not the public at large.

The underlying DB would be MariaDB.

What should I be concerned about from this idea? If it’s a bad idea, why?

I thought about the possibility of making a query that doesn’t terminate by using WITH RECURSIVE, so I’m not going to support that syntax, and I made the following question at the DBA SE to see what other ways a SELECT statement could be non-terminating (I thought of a few more while writing that question):

What are all the ways that a SELECT statement could be made to not terminate or take a very long time?

Besides that, is there anything more? Any particular risk? Is it possible to make some type of resource bomb with it, to consume all memory for example?

Access to this language could be put under a permission so only very privileged users could use it, but I wonder if that’s needed.

Create dynamic sql query to select all related data in DB based on entry table and ID

Hope all is well. I am hoping you can help me.

Problem Statement – I’m tasked to create a dynamic SQL statement which will select all related data from a given table where the Identifier is passed. For each table where the relevant data is found i would like the data to be exported onto a separate tab of within excel

If i was doing this manually done this i would perform the following queries and export the data onto each tab;

Select * from  Mason where id = 12345 Select * from  MasonContacts where Companyid= 12345  Select * from  MasonOpportunities  where Comid = 12345  

However given the sheer volume of tables this isn’t viable.

Step 1 : Type in my identifier (in this case my identifier is a field called "Id" in the Table "Mason") The query will always start from this table.

Table Name : Mason Field : Id = "12345"

Step 2 : Search against table "MasonContacts", search against the field "Companyid". Return all columns & records where the field "Companyid = 12345"

Table Name : MasonContacts Field : Companyid

Step 3 : Search against table "Mason Opportunities ", search against the field "Comid". Return all columns & records where the field "Company = 12345"

Table Name : MasonOpportunities Field : Comid

Looking forward to your help

Purposefully fail select with no where

We have an evil query that reads every row from a table, but should not. To help the devs find the source of that query, I want to make SQL Server error out when any select against that table has no where clause.


An app is doing an evil select with no where. The select reads every row of a table having about 6,500 rows. The select is fast in SSMS (< 1 second), but when run by the app it’s slow (about 1/2 hour). We think that’s because the app is slowly iterating over the result set. It’s an active table for updates and inserts, so other queries may be blocked while this read takes place.

The developers can think of no reason that any app should read every row of that table. They suspect an oversight by a past developer.

The evil query-with-no-where is my top-runner, by far, for having the longest total duration in Query Store.

I know which app is issuing the evil query by using SQL Profiler to identify the app name, host name, and DB user name. The app’s developers have been unable to locate the source of the evil query. I want to help.

I want to cause any select against that table that has no WHERE clause (i.e. selects every row) to fail immediately. Our hope is that the app will log the errors, or possibly an end user that triggered the activity will report a 500 error to us, and this will give us another clue to find what code is issuing the evil query-with-no-where.

Our other selects against that table have specific where clauses and only return a subset of the table’s rows. Those selects must be allowed to continue.

Can a Wizard select an alternative capstone?

More specifically, I’m building a Wizard and I’d like him to have the Perfect Body, Flawless Mind capstone (+8 Int).

I’m planning for him to be a diviner, specialized: Foresight, with the Pact Wizard (HH) archetype (that, as far I can tell, does not replace a wizard’s capstone, since a wizard does not have one to begin with), and wonder if it’d still be legal to get the alternative capstone.

Does the natural 20 from Forewarned (Divination school) count as a capstone?

At 20th level, anytime you roll initiative, assume the roll resulted in a natural 20.

If so, am I able to select the alternative capstone in its place (since it’s not an archetype)?

If not, could I do it as an universalist?

Relevant reference:

Alternative Capstone Ability

When a character reaches the 20th level of a class, she gains a powerful class feature or ability, sometimes referred to as a capstone. When a character reaches 20th level in this class, the following new ability can be selected instead of the standard 20th level class ability which would normally be gained. In some cases, a capstone specifies what ability it replaces. A character can’t select an alternative capstone if she has previously traded away her class capstone via an archetype. Clerics and wizards can receive a capstone at 20th level, despite not having one to begin with.

What is the suitable file structure for database if queries are select (relational algebra) operations only?

Searches related to A relation R(A, B, C, D) has to be accessed under the query σB=10(R). Out of the following possible file structures, which one should be chosen and why? i. R is a heap file. ii. R has a clustered hash index on B. iii. R has an unclustered B+ tree index on (A, B).

Select Into a temp table in DB2

Let me preface this question in that while I have a strong background in T-SQL but I am still just a newbie when it comes to DB2.

The root query looks roughly like this:

Select      Col1, Col2, Col3 From (     Select A.Col1, B.Col2, B.Col3     From SchemaA.TableA as A         Inner Join SchemaA.TableB as B             On A.Id = B.ParentId     Where          A.Col2 = 'TypeValue'     Fetch First 5 Rows Only -- This is not allowed in a union or sub select      Union      Select A.Col1, B.Col2, B.Col3     From SchemaB.TableA as A         Inner Join SchemaB.TableB as B             On A.Id = B.ParentId     Where          A.Col2 = 'TypeValue'     Fetch First 5 Rows Only -- This is not allowed in a union or sub select ) as Hybrid 

Because Fetch First X Rows is not allowed in subselects or with unions, this isn’t going to work. Since we’re limiting the output, it makes sense to limit the input.

I figure I can achieve a fake union by feeding my subselects into temp tables instead and returning that output instead.

In T-SQL, I can create a temp table on the fly with a query like this how would I do that in DB2?

Select * Into #Temp From TableA 

How would I do that in DB2? Or would do I need to create the table before inserting data into it?