You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "TalhaMunir-JD (via GitHub)" <gi...@apache.org> on 2023/03/04 10:35:18 UTC

[GitHub] [age] TalhaMunir-JD commented on issue #452: Match / Create / Set / Remove / Delete / Merge / Call / Yield Clause

TalhaMunir-JD commented on issue #452:
URL: https://github.com/apache/age/issues/452#issuecomment-1454693718

   Match clause:
   Match clause is used for searching specific values. It is mostly used with Against function. For example in below query searches the table student where the name column contains the word Talha:
   SQL: 
   SELECT * FROM student WHERE MATCH(name) AGAINST(‘Talha’);
   
   
   Create clause:
   The create clause is used to create a new table, index, or view in the database. E.g. the following query creates a new table student with fields id, name, and email.
   SQL:
   CREATE TABLE student (
       id INT PRIMARY KEY,
       name VARCHAR(255),
       email VARCHAR(255)
   );
   
   
   Set clause:
   The set clause is used to update the values in a table. E.g. the following query updates the email address of the student whose id is 1
   SQL:
   UPDATE student SET email='new@email.com' WHERE id=1;
   
   
   Delete Clause:
   Delete clause is used to remove rows from the table. E.g following query removes all rows from the table student whose email column is empty
   SQL:
   DELETE FROM student where email = ‘’;
   
   
   
   Merge Clause:
   The merge clause combines data from 2 or more sources into a single table. It is mostly used with union or union all operators. Just like following SQL statement combines data from student and courses tables.
   SQL:
   SELECT id, name ‘student’ as type FROM students
   UNION
   SELECT id, courseName, 'course' as type FROM courses;
   
   
   Call clause:
   The call clause is used to execute a stored method. For example the following query calls the a stored procedure get_student_information.
   SQL:
   CALL get_student_information(1);
   
   
   Yield clause:
   Yield clause is used to return data from a stored method or a function. For example the following function is used to return a result set containing information of students.
   SQL:
   CREATE PROCEDURE get_student_information (id INT)
   BEGIN
       SELECT * FROM students WHERE id = id;
       YIELD;
   END;
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org