Sabtu, 21 Agustus 2021

PostgreSQL Potong Tulisan bukan ditengah Kata

  • Get the first 50 characters of the description column
  • Determine the position of the last whitespace character of the truncated description column and subtract it from the number 50 as the second parameter in the first function above.


  UPPER( || ': ' || f.title AS film_category, 
  -- Truncate the description without cutting off a word
  LEFT(description, 50 - 
    -- Subtract the position of the first whitespace character
      ' ' IN REVERSE(LEFT(description, 50))
  film AS f 
  INNER JOIN film_category AS fc 
    ON f.film_id = fc.film_id 
  INNER JOIN category AS c 
    ON fc.category_id = c.category_id;

ACTION: WEREWOLF LOLAA Fanciful Story of a Man And a Sumo Wrestler who
ACTION: WATERFRONT DELIVERANCEA Unbelieveable Documentary of a Dentist And a
ACTION: UPRISING UPTOWNA Fanciful Reflection of a Boy And a Butler who
ACTION: TRUMAN CRAZYA Thrilling Epistle of a Moose And a Boy who must
ACTION: TRIP NEWTONA Fanciful Character Study of a Lumberjack And a

Tidak ada komentar:

Posting Komentar


Related Posts Plugin for WordPress, Blogger...


Do it Yourself (41) Sepeda (30) soluna (30) Motorcycle (29) GoPro (28) Roda4 (23) Jual (20) Travelling (19) nouvo (19) jupiter (14) Jasa (10) mutasi (10) office (9) King (8) vw (6) Dad (5) gokart (3) Atoz (2) tamiya (2) balance bike (1) strider (1)