String के Functions (UPPER LOWER LENGTH)
String functions text transform और inspect करते हैं।
In this page:
Syntax
SELECT UPPER(column), LOWER(column), LENGTH(column), SUBSTR(column, start, length)
FROM table_name;
String Functions (UPPER LOWER LENGTH)
UPPER और LOWER case बदलते हैं, LENGTH characters count करता है, SUBSTR (या SUBSTRING) string का हिस्सा extract करता है, TRIM surrounding spaces remove करता है, REPLACE text swap करता है, और || strings जोड़ता है।
PostgreSQL INITCAP, LEFT, RIGHT, SPLIT_PART, और CONCAT_WS जैसे और कई add करता है। Example portable functions इस्तेमाल करता है।
Note:
PostgreSQL का INITCAP हर word capitalise करता है।
उदाहरण: String functions (UPPER LOWER LENGTH)
CREATE TABLE people (id INTEGER PRIMARY KEY, first TEXT, last TEXT);
INSERT INTO people VALUES (1, ' ada ', 'LOVELACE'), (2, 'alan', 'Turing');
SELECT UPPER(TRIM(first)) AS first_up, LOWER(last) AS last_low FROM people;
SELECT LENGTH(last) AS len, SUBSTR(last, 1, 3) AS first3 FROM people;
SELECT TRIM(first) || ' ' || last AS full_name FROM people;
SELECT REPLACE(last, 'ing', 'ONG') AS replaced FROM people;
-- Output:
-- first_up | last_low
-- ADA | lovelace
-- ALAN | turing
-- len | first3
-- 8 | LOV
-- 6 | Tur
-- full_name
-- ada LOVELACE
-- alan Turing
-- replaced
-- LOVELACE
-- TurONG
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- strings जोड़ने के लिए + इस्तेमाल करना
- यह भूल जाना कि SUBSTR में strings 1-indexed हैं
- indexed columns पर functions apply करना और index use खोना
चैप्टर सारांश
- UPPER, LOWER, LENGTH jaise functions मिलते हैं
- SUBSTR extract करता है, TRIM clean करता है
- REPLACE text swap करता है
- || concatenate करता है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: