PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

RIGHT()()

← All stacks

Theory

163/439

RIGHT()()

RIGHT() last n characters. You use it in SELECT (and sometimes WHERE/UPDATE). It does not change stored data unless you UPDATE … SET col = RIGHT(col).

Board: SELECT RIGHT(name, 2) FROM students; Run it. Say the result out loud. If the column is NULL, the result is often NULL — wrap with IFNULL if you need a blank instead.

String indexes in MySQL start at 1, not 0 (SUBSTR, INSTR, LEFT). Not RIGHT JOIN.

Interview — name RIGHT, one argument list, one example on the students table. Don’t recite every string function.

On the example next to this theory — RIGHT()() — jOIN combines rows using a match condition between tables.

Exam tip

Say what RIGHT returns, then SELECT RIGHT(name, 2) FROM students;

RIGHT()() — sample query

CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER, total INTEGER);
INSERT INTO customers VALUES (1, 'Asha'), (2, 'Ravi');
INSERT INTO orders VALUES (10, 1, 500), (11, 1, 200);
SELECT c.name, o.total
FROM customers c
JOIN orders o ON o.customer_id = c.id;

RIGHT()() — jOIN combines rows using a match condition between tables.

Short notes

  • DefRIGHT() last n characters.
  • RuleSELECT RIGHT(name, 2) FROM students;
  • TrapNot RIGHT JOIN.

Questions

1

What does RIGHT do?

2

Does it UPDATE the table?

163 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.