## How come Min function in this query statement print name rather than integers

This is a question on

Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, Singer, and Actor, respectively. Note: Print NULL when there are no more names corresponding to an occupation.

Input Format The OCCUPATIONS table is described as follows:

Column Type Name String Occupation String Occupation will only contain one of the following values: Doctor, Professor, Singer or Actor.

Sample Input  Name    Occupation Samantha    Doctor Julia   Actor Maria   Actor Meera   Singer Ashely  Professor Ketty   Professor Christeen   Professor Jane    Actor Jenny   Doctor Priya   Singer 

]

Sample Output

Jenny Ashley Meera Jane Samantha Christeen Priya Julia NULL Ketty NULL Maria 

Explanation The first column is an alphabetically ordered list of Doctor names. The second column is an alphabetically ordered list of Professor names. The third column is an alphabetically ordered list of Singer names. The fourth column is an alphabetically ordered list of Actor names. The empty cell data for columns with less than the maximum number of names per occupation (in this case, the Professor and Actor columns) are filled with NULL valu

SET @r1=0, @r2=0, @r3 =0, @r4=0; SELECT MIN(Doctor), MIN(Professor), MIN(Singer), MIN(Actor) FROM (SELECT CASE Occupation WHEN 'Doctor' THEN @r1:=@r1+1                        WHEN 'Professor' THEN @r2:=@r2+1                        WHEN 'Singer' THEN @r3:=@r3+1                        WHEN 'Actor' THEN @r4:=@r4+1 END        AS RowLine,        CASE WHEN Occupation = 'Doctor' THEN Name END AS Doctor,        CASE WHEN Occupation = 'Professor' THEN Name END AS Professor,        CASE WHEN Occupation = 'Singer' THEN Name END AS Singer,        CASE WHEN Occupation = 'Actor' THEN Name END AS Actor        FROM OCCUPATIONS ORDER BY Name) AS t GROUP BY RowLine; 

My doubt how come MIN(DOCTOR) print names This is from ..Here in this tutorials it comes as number

Please give me a solid answer .I am in the process of learning mysql

## Probability that one random variable is greater than another

Suppose I have two random variables:

Control = BetaDistribution[24,141] Var = BetaDistribution[30,151] 

I can sample from this easy enough with RandomVariate[Var, 10]  and calculate the probability that one of the distributions is greater than a constant, e.g. Probability[x <= .2, x \[Distributed] Var].

But how do I calculate $$P(Var>Control)$$. Many thanks!

## How to select p terms with powers larger than 1 in a given expression?

My expression is:

$$expr = \frac{p^{\frac{1}{3}} q + 5}{3q^2} + p^2 + (p -1)^{\frac{1}{3}}$$

And I want to single out all terms with $$p^k, k > 1$$

How should I do that? (If there is any way other than applying Series[] would be the best, since I want it to be less time-consuming when dealing with large expr.)

## Why the UI text value is changing take affect only when returning back to the visual studio window and than back to the editor?

My guess is because I’m using OnValidate but is there another way to try to accomplish what I’m trying ?

The goal is use the drawn circle in one script information and use this information in another script.

For example the GameObject the draw circle script is attached to I want to get the Y position of that GameObject and assign the value to the other script specific variable in both Editor and Runtime modes.

This script draw a circle in this case around my player and I attached this script to a empty GameObject child of my player so I can change the circle height by changing the GameObject Y position :

using UnityEngine; using System.Collections; using System;  [ExecuteAlways] [RequireComponent(typeof(LineRenderer))] public class DrawRadiusAroundObject : MonoBehaviour {     [Range(1, 50)] public int segments = 50;     [Range(1, 5)] public float xRadius = 5;     [Range(1, 5)] public float yRadius = 5;     [Range(0.1f, 5f)] public float width = 0.1f;     public bool controlBothXradiusYradius = false;     public bool draw = true;      [SerializeField] private LineRenderer line;      private void Start()     {         if (!line) line = GetComponent<LineRenderer>();          CreatePoints();     }      //private void Update()     //{     //         //}      public void CreatePoints()     {         line.enabled = true;         line.widthMultiplier = width;         line.useWorldSpace = false;         line.widthMultiplier = width;         line.positionCount = segments + 1;          float x;         float y;          var angle = 20f;         var points = new Vector3[segments + 1];         for (int i = 0; i < segments + 1; i++)         {             x = Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius;             y = Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius;              points[i] = new Vector3(x, 0f, y);              angle += (380f / segments);         }          // it's way more efficient to do this in one go!         line.SetPositions(points);     }  #if UNITY_EDITOR     private float prevXRadius, prevYRadius;     private int prevSegments;     private float prevWidth;      private void OnValidate()     {         // Can't set up our line if the user hasn't connected it yet.         if (!line) line = GetComponent<LineRenderer>();         if (!line) return;          if (!draw)         {             // instead simply disable the component             line.enabled = false;         }         else         {             // Otherwise re-enable the component             // This will simply re-use the previously created points             line.enabled = true;              if (xRadius != prevXRadius || yRadius != prevYRadius || segments != prevSegments || width != prevWidth)             {                 CreatePoints();                  // Cache our most recently used values.                 prevXRadius = xRadius;                 prevYRadius = yRadius;                 prevSegments = segments;                 prevWidth = width;             }              if (controlBothXradiusYradius)             {                 yRadius = xRadius;             }         }     } #endif } 

The object with the drawn circle :

And this script is making an object the Target child to rotate around my player. I want by using the drawn circle information to set the rotating variables.

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  [ExecuteAlways] public class SimpleRotate : MonoBehaviour {     public List<TextMeshProUGUI> uiText = new List<TextMeshProUGUI>();      public DrawRadiusAroundObject drawAround;      // Add this script to Cube(2)     [Header("Add your turret")]     public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.      [Header("The axis by which it will rotate around")]     public Vector3 axis;//by which axis it will rotate. x,y or z.      [Header("Angle covered per update")]     public float angle; //or the speed of rotation.      public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;      private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;       // Update is called once per frame     void Update()     {         //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update          transform.RotateAround(Turret.transform.position, axis.normalized, angle);         time += Time.deltaTime;         //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay          if (time > delay)         {             prevHeight = height;             height = Random.Range(lowerLimit, upperLimit);             time = 0;         }         //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)           transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);          uiText[0].text = angle.ToString();         uiText[1].text = upperLimit.ToString();         uiText[2].text = lowerLimit.ToString();         uiText[3].text = delay.ToString();          upperLimit = drawAround.transform.position.y;     } } 

The basketball rotating around my player.

For example I tried to set the object Y position value on the Upper Limit variable in the SimpleRotate script.

Everything is getting update find in editor mode and runtime mode except the ui text.

First of all I’m not sure using [ExecuteAlways] in both scripts is the right way and second because I’m using OnValidate in the script that draw the circle the affecting on the variable upper limit is taking affect only when I validate by changing windows in the editor mode.

## Is renaming schemas more efficient / faster than drop/create in a single transaction

Given the constraint (from customer side) to having only one database – how can I most effectively deploy new versions of data into a production-facing application.

The new data is packaged into a (-Fc) dump file. This data is supposed to replace the existing data, so restoring it must be done by first dropping the existing tables and then restoring the new ones.

The naive approach of just importing the dump file with pg_restore with --single-transaction will lock the whole database which will cause the application dependent on that data to halt/suspend queries.

My intended approach is to utilize schemas. Basically, the application will have set its connection string to use mydb.public. The import imports all new data into mydb.next.

Then, rename mydb.public to mydb.old, rename mydb.next to mydb.public and drop mydb.old.

Would this approach result in a shorter downtime than importing directly? I am not sure how renames of schemas work internally in postgres, but from my surface understanding, it should be a more efficient approach

## SMS-MAN – Mobile and Residential proxies and SMS verification | More than 350 different countries

Sms-man provide Mobile and Residential proxies for over 300 countries at minimal prices.

– We have a huge selection of a wide variety of countries

– ease of use, you can get a proxy in a matter of minutes
– low price and high quality of service

Prices for all countries from 1.90$## Virtual numbers for receiving SMS We also provide virtual numbers for SMS verification, with our service you can register without a phone number in Telegram, WhatsApp, Instagram, Vkontakte, Ebay, Amazon and others populat sites and apps Contacts: Our website: https://sms-man.com/ Our Telegram-bot with proxy: @Smsman_Proxy_bot Email: vyacheslav@sms-man.ru ## Is this possible to set up in the dns register other than the web hosting? My domain is hosted in a domain name registry cloudflare and the domain is hosted in the shopify. We have QR code tagged with each product selling in the shopify. If a customer scan it it will go to mydomain.com?specialCode=123456 and he/she could win a prize. Recently we’ve developed the sns application on different sub domain sns.mydomain.com. I want to know if we can set up redirect to go to sns.mydomain.com if the url has specialCode attached. Hopefully I can set up a redirect on the name on the cloudflare so we don’t need to redirect from client side since shopify doesn’t give you access to the server side. Is this possible? ## How to make a custom category archive page display names for each of terms when displaying a page showing more than one I have a custom page for a specific custom category which was derived from archive.php. On this page I have a "Search and Filter" (plugin) set of checkboxes which allows for a selection of one or more categories and the results are then displayed. This all works well. I’m using a custom category (added with Pods) called "rk_themes" and labelled as "Themes". I need to show the term names that were selected in a status line along with the number of results. It should show “10 works found for Category Name A, Category Name B”. The URL for this is like https://example.net/theme/category-name-a+category-name-b Showing the count is easy enough, but I can’t figure out how to access the term names. A var_dump of WP_Query suggests there is only a label for the first term. ## Display wp post views only if it’s more than 1000 I paste this code to my functions.php function getCrunchifyPostViews($  postID){ $count_key = 'post_views_count';$  count = get_post_meta($postID,$  count_key, true); if($count==''){ delete_post_meta($  postID, $count_key); add_post_meta($  postID, $count_key, '0'); return "0 View"; } return$  count.' Views'; }  function setCrunchifyPostViews($postID) {$  count_key = 'post_views_count';     $count = get_post_meta($  postID, $count_key, true); if($  count==''){         $count = 0; delete_post_meta($  postID, $count_key); add_post_meta($  postID, $count_key, '0'); }else{$  count++;         update_post_meta($postID,$  count_key, \$  count);     } }   remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); 

and this code to single.php:

<?php           setCrunchifyPostViews(get_the_ID()); ?> 

and it too:

<?php           echo getCrunchifyPostViews(get_the_ID()); ?> 

The post view is working fine, but I would like to display on single.php if the current post views is more than 1000. Any idea how can i made it?

## Can a MySQL FOREIGN KEY CONSTRAINT reference a column value rather than a column name?

I have a child table whose rows are related to various parent tables by parent_table_name, and parent_id columns.

Can I set up a foreign key constraint for these relationships?

In the tables below, I can run queries such as SELECT * FROM parent_1 p1 JOIN child c ON p1.id = c.parent_id AND c.parent_table_name = 'parent_1'; to get a row from parent_1 and any related rows from child.

CREATE TABLE parent_1 (       id INT NOT NULL AUTO_INCREMENT     , PRIMARY KEY(id) );  INSERT INTO parent_1 VALUES(1);  CREATE TABLE parent_2 (       id INT NOT NULL AUTO_INCREMENT     , PRIMARY KEY(id) );  INSERT INTO parent_2 VALUES(1);  CREATE TABLE child (       id INT NOT NULL AUTO_INCREMENT     , parent_table_name VARCHAR(16) NOT NULL     , parent_id INT NOT NULL     , some_interesting_value VARCHAR(255) NOT NULL     , PRIMARY KEY(id)     , KEY (parent_table_name, parent_id) );  INSERT INTO child VALUES(NULL, 'parent_1', 1, 'Hello world'); INSERT INTO child VALUES(NULL, 'parent_2', 1, 'Goodbye world'); 

I have tried adding a constraint as below, but got a 1064 error.

ALTER TABLE parent_1 ADD CONSTRAINT p1_children FOREIGN KEY ("parent_1", id)     REFERENCES child (parent_table_name, parent_id);  ERROR 1064 (42000): You have an error in your SQL syntax;     check the manual that corresponds to your MySQL server version     for the right syntax to use near '"parent_1", id) REFERENCES     child (parent_table_name, parent_id)' at line 1 

Is there some way to set up this sort of constraint? Or is the only way to have a third table that has the primary keys from the parent and child table?