Snippets Collections
SELECT DISTINCT
   SubscriberKey,
   Mobile,
   MessageID,
   Name,
   Sent,
   Delivered,
   Undelivered,
   SMSStandardStatusCodeId,
   Description,
   ModifiedDateTime
FROM _SMSMessageTracking
WHERE Name = 'EmailName' AND Mobile='MobileNumber'
  // Derived state. These are the posts that will actually be displayed
  const searchedPosts = searchQuery.length > 0 ? posts.filter((post) => `${post.title} ${post.body}`.toLowerCase().includes(searchQuery.toLowerCase())) : posts;
function mediaQuery(element, value) {
  let x = document.querySelectorAll(element);

  x.forEach((item) => {
    if (window.matchMedia(`(max-width: ${value}px)`).matches) {
      item.classList.add('mobile');

    } else {
      item.classList.remove('mobile');
    }

  })

  return x;

}

// add class mobile to the element class hero on the screensize 600px
mediaQuery(".hero", 600);
db.collection("Groups").whereField("group_members", arrayContains: userId ?? "324").getDocuments() {(groups, error) in
                if error != nil {
                    print("Error getting documents: \(error!)")
                } else { }
user = User.first

result = user.user_books.in_order_of(:status, %w[to_read currently_reading read])

=> #<ActiveRecord::Relation [#<UserBook id: 3, user_id: 1, status: "to_read">, #<UserBook id: 4, user_id: 1, status: "to_read">, #<UserBook id: 5, user_id: 1, status: "currently_reading">, #<UserBook id: 6, user_id: 1, status: "read">]>
select *
from shortform.submitted s 
where user_input is not null and user_input != '{}' and "name" is not null and "name" != '{}'
order by random()
limit 10;
select distinct count(*)
from auth."user"
inner join shortform.firm on shortform.firm.organization_id = auth."user".organization_id 
limit 10;
​select distinct ?school ?schoolLabel

where {
  ?school wdt:P31/wdt:P279* wd:Q38723. 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

limit 100
The 'tax_query' clauses can be nested, to create more complex queries. Example: Display posts that are in the quotes category OR both have the quote post format AND are in the wisdom category:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		'relation' => 'OR',
		array(
			'taxonomy' => 'category',
			'field'    => 'slug',
			'terms'    => array( 'quotes' ),
		),
		array(
                        'relation' => 'AND',
                        array(
			        'taxonomy' => 'post_format',
			        'field'    => 'slug',
			        'terms'    => array( 'post-format-quote' ),
                        ),
                        array(
                                'taxonomy' => 'category',
                                'field'    => 'slug',
                                'terms'    => array( 'wisdom' ),
                        ),
		),
	),
);
$query = new WP_Query( $args );

Display posts from several custom taxonomies:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		'relation' => 'AND',
		array(
			'taxonomy' => 'movie_genre',
			'field'    => 'slug',
			'terms'    => array( 'action', 'comedy' ),
		),
		array(
			'taxonomy' => 'actor',
			'field'    => 'term_id',
			'terms'    => array( 103, 115, 206 ),
			'operator' => 'NOT IN',
		),
	),
);
$query = new WP_Query( $args );
Simple Taxonomy Query:

Display posts tagged with bob, under people custom taxonomy:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		array(
			'taxonomy' => 'people',
			'field'    => 'slug',
			'terms'    => 'bob',
		),
	),
);
$query = new WP_Query( $args );
-- From https://github.com/bertwagner/SQLServer/blob/master/Non-SARGable%20Execution%20Plans.sql
-- This script will check the execution plan cache for any queries that are non-SARGable.
-- It does this by finding table and index scans that contain a scalar operators

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
 
DECLARE @dbname SYSNAME
SET @dbname = QUOTENAME(DB_NAME());
 
WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')

SELECT
   stmt.value('(@StatementText)[1]', 'varchar(max)') AS [Query],
   query_plan AS [QueryPlan],
   sc.value('(.//Identifier/ColumnReference/@Schema)[1]', 'varchar(128)') AS [Schema], 
   sc.value('(.//Identifier/ColumnReference/@Table)[1]', 'varchar(128)') AS [Table], 
   sc.value('(.//Identifier/ColumnReference/@Column)[1]', 'varchar(128)') AS [Column] ,
   CASE WHEN s.exist('.//TableScan') = 1 THEN 'TableScan' ELSE 'IndexScan' END AS [ScanType],
   sc.value('(@ScalarString)[1]', 'varchar(128)') AS [ScalarString]
FROM 
	sys.dm_exec_cached_plans AS cp
	CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) AS qp
	CROSS APPLY query_plan.nodes('/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple') AS batch(stmt)
	CROSS APPLY stmt.nodes('.//RelOp[TableScan or IndexScan]') AS scan(s)
	CROSS APPLY s.nodes('.//ScalarOperator') AS scalar(sc)
WHERE
    s.exist('.//ScalarOperator[@ScalarString]!=""') = 1 
    AND sc.exist('.//Identifier/ColumnReference[@Database=sql:variable("@dbname")][@Schema!="[sys]"]') = 1
	AND sc.value('(@ScalarString)[1]', 'varchar(128)') IS NOT NULL
star

Tue Apr 23 2024 12:49:13 GMT+0000 (Coordinated Universal Time)

#dataview #sms #query
star

Thu Feb 15 2024 22:04:22 GMT+0000 (Coordinated Universal Time)

#react #filter #query
star

Tue Nov 01 2022 04:42:54 GMT+0000 (Coordinated Universal Time)

#media #query #mediaquery
star

Thu Jan 13 2022 12:10:26 GMT+0000 (Coordinated Universal Time)

#ios #swift #query
star

Tue Nov 30 2021 16:35:12 GMT+0000 (Coordinated Universal Time) https://blog.saeloun.com/2021/10/05/rails-7-activerecord-adds-in_order_of-method

#sql #arel #query
star

Sat May 29 2021 22:50:10 GMT+0000 (Coordinated Universal Time)

#sparql #wikidata #query
star

Sat May 29 2021 22:04:22 GMT+0000 (Coordinated Universal Time)

#sparql #wikidata #query
star

Fri May 21 2021 23:48:41 GMT+0000 (Coordinated Universal Time) https://query.wikidata.org/

#sparql #wikidata #query
star

Thu Oct 01 2020 20:31:22 GMT+0000 (Coordinated Universal Time) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Thu Oct 01 2020 20:30:16 GMT+0000 (Coordinated Universal Time) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Thu Oct 01 2020 20:29:15 GMT+0000 (Coordinated Universal Time) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Sun Aug 16 2020 11:59:20 GMT+0000 (Coordinated Universal Time) https://bertwagner.com/2017/08/22/how-to-search-and-destroy-non-sargable-queries-on-your-server/

#sql #query

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension