sql

Extract phone number from noised string

落爺英雄遲暮 提交于 2021-02-14 18:35:00
问题 I have a column in a table that contains random data along with phone numbers in different formats. The column may contain Name Phone Email HTML tags Addresses (with numbers) Examples: 1) Call back from +79005346546, Conversation started<br>Phone: +79005346546<br>Called twice Came from google.com<br>IP: 77.106.46.202 the web page address is xxx.com utm_medium: cpc<br>utm_campaign: 32587871<br>utm_content: 5283041 79005346546 2) John Smith 3) xxx@yyy.com 4) John Smith 8 999 888 77 77 How a

What does the @ symbol means on a Procedure in MySQL?

六眼飞鱼酱① 提交于 2021-02-14 08:21:54
问题 What's the difference between accessing a variable with @ or without? 回答1: The @ makes it a user defined session variable. Otherwise it would be locally scoped variable (in a stored procedure), you would have to DEFINE your local before you can SET it. You could also set a global system variable (with SET GLOBAL or SET @@global ) if you wanted to. As well as a session system variable with SET SESSION var or SET @@session var or SET @@var . More details about SET from the documentation: If no

What does the @ symbol means on a Procedure in MySQL?

你。 提交于 2021-02-14 08:17:34
问题 What's the difference between accessing a variable with @ or without? 回答1: The @ makes it a user defined session variable. Otherwise it would be locally scoped variable (in a stored procedure), you would have to DEFINE your local before you can SET it. You could also set a global system variable (with SET GLOBAL or SET @@global ) if you wanted to. As well as a session system variable with SET SESSION var or SET @@session var or SET @@var . More details about SET from the documentation: If no

Table as an argument of a PostgreSQL function

南笙酒味 提交于 2021-02-13 17:35:06
问题 I'm trying to pass a table as an argument in a PostgreSQL function, and I can't find the right keyword (what should be instead of table in my code) in the first line : CREATE FUNCTION test.fcttest(table) RETURNS SETOF test.out_table AS $$ INSERT INTO test.out_table /* obviously, the schema for this table is what it should be, an int column for A.id and a varchar(30) column for A.another_field */ SELECT A.id, A.another_field FROM $1 A; SELECT A.id, A.another_field FROM $1 A; $$ LANGUAGE SQL;

Table as an argument of a PostgreSQL function

冷暖自知 提交于 2021-02-13 17:34:41
问题 I'm trying to pass a table as an argument in a PostgreSQL function, and I can't find the right keyword (what should be instead of table in my code) in the first line : CREATE FUNCTION test.fcttest(table) RETURNS SETOF test.out_table AS $$ INSERT INTO test.out_table /* obviously, the schema for this table is what it should be, an int column for A.id and a varchar(30) column for A.another_field */ SELECT A.id, A.another_field FROM $1 A; SELECT A.id, A.another_field FROM $1 A; $$ LANGUAGE SQL;

Table as an argument of a PostgreSQL function

廉价感情. 提交于 2021-02-13 17:33:59
问题 I'm trying to pass a table as an argument in a PostgreSQL function, and I can't find the right keyword (what should be instead of table in my code) in the first line : CREATE FUNCTION test.fcttest(table) RETURNS SETOF test.out_table AS $$ INSERT INTO test.out_table /* obviously, the schema for this table is what it should be, an int column for A.id and a varchar(30) column for A.another_field */ SELECT A.id, A.another_field FROM $1 A; SELECT A.id, A.another_field FROM $1 A; $$ LANGUAGE SQL;

mysql syntax explanation

帅比萌擦擦* 提交于 2021-02-13 16:04:16
问题 I would like to know what the a.*, c.name, ... a.access etc means. In other words, what exactly am I referring to when I add a letter before the dot and the funciton of the dot. Here is an example of code where I found this occurrence: $query = "SELECT a.*, c.name as categoryname,c.id as categoryid, ". "c.alias as categoryalias, c.params as categoryparams". " FROM #__k2_items as a". " LEFT JOIN #__k2_categories c ON c.id = a.catid"; $query .= " WHERE a.published = 1" ." AND a.access <= {$aid}

mysql syntax explanation

余生长醉 提交于 2021-02-13 16:00:05
问题 I would like to know what the a.*, c.name, ... a.access etc means. In other words, what exactly am I referring to when I add a letter before the dot and the funciton of the dot. Here is an example of code where I found this occurrence: $query = "SELECT a.*, c.name as categoryname,c.id as categoryid, ". "c.alias as categoryalias, c.params as categoryparams". " FROM #__k2_items as a". " LEFT JOIN #__k2_categories c ON c.id = a.catid"; $query .= " WHERE a.published = 1" ." AND a.access <= {$aid}

Why do SQL id sequences go out of sync (specifically using Postgres)?

≡放荡痞女 提交于 2021-02-13 12:04:03
问题 I've seen solutions for updating a sequence when it goes out of sync with the primary key it's generating, but I don't understand how this problem occurs in the first place. Does anyone have insight into how a primary key field, with its default defined as the nextval of a sequence, whose primary keys aren't set explicitly anywhere, can go out of sync with the sequence? I'm using Postgres, and we see this occur now and then. It results eventually in a duplicate key constraint when the

Why do SQL id sequences go out of sync (specifically using Postgres)?

强颜欢笑 提交于 2021-02-13 12:02:57
问题 I've seen solutions for updating a sequence when it goes out of sync with the primary key it's generating, but I don't understand how this problem occurs in the first place. Does anyone have insight into how a primary key field, with its default defined as the nextval of a sequence, whose primary keys aren't set explicitly anywhere, can go out of sync with the sequence? I'm using Postgres, and we see this occur now and then. It results eventually in a duplicate key constraint when the