How to be a command in SQL using LIKE? [closed] - sql

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to select records where a field (varchar (45)) contains one and only one letter x and the field length is greater than 20

In MySQL you can do:
SELECT * FROM tablename WHERE fieldname REGEXP '^[x]{20,}$'

Related

ORA-03291: Invalid truncate option - missing STORAGE keyword [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
i have to execute two statements in a sequence. My Statement is as below. I get the above error when i run this.
TRUNCATE TABLE MANUAL_LIST_BACKUP
INSERT INTO MANUAL_LIST_BACKUP AS SELECT * FROM MANUAL_TRANSACTIONS
Separate the two statements with a ;

finding the word like in a sql query [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a string like this:
i would like to go to office, and i would like to go to market
My question is: how many times the word like occurs in the string?
Please write a query.
You can use regexp_count:
SELECT REGEXP_COUNT('i like to go , and i would like market', 'like')
FROM DUAL;
The word "like" occurs twice in the string you posted.
The following is a query:
SELECT *
FROM SOME_TABLE
WHERE SOME_VALUE = SOME_OTHER_VALUE
Share and enjoy.

Search for all strings that have a space in between using SQL query [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Take for example I have entries like 'Jhon Abraham','Hrithik Roshan' and 'Jimmy'.
Then, the output should fetch me the first two entries i.e. 'Jhon Abraham' and 'Hrithik Roshan'.
SELECT columnName
FROM table
WHERE trim(columnName) LIKE '% %'
SELECT col_name FROM table_name WHERE col_name LIKE '% %';

How to convert money to decimal in SQL Server stored procedure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have stored procedure where want convert money type to decimal type.
#money = 513.9010 type money
I want to convert it to decimal - how to do that?
select convert(decimal(7,4),#money)

Counting lines in a list [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I have a list of objects and colors; each object has a color. I want to create a query that will count how many objects I have of each color.
What function should I use?
You might write a query like this:
SELECT COUNT(color) AS cnt, color FROM YourTable
GROUP BY color
SELECT Color, Count(Objects)
FROM myTable
GROUP BY Color