![]() ![]() SQL delete records using subqueries with alias and MIN and COUNT The following SQL statement can be used : I) 'ord_amount' of alias 'a' must be equal to the minimum 'ord_amount' of alias 'b' which satisfies the condition bellow :Ī) 'ord_date' of alias 'a' and alias 'b' must be equal, 'agent_code' of 'agent1' should be within the 'agent_code' in alias 'a' which satisfies the condition bellow : 'orders' table used as alias 'a' and alias 'b',Ģ. In this page, we are going to discuss, how rows can be removed from a table by SQL DELETE statement along with the SQL MIN() function.ġ. Output: SQL delete records using subqueries with alias and MIN WHERE agent1.agent_codecustomer.agent_code) 'agent_code' of 'agent1' table and 'agent_code' of 'customer' table should not be same, check the number 3 is in the result of the subquery which satisfies the condition bellow :ģ. 'da' and 'cu' are the aliases of 'agent1' and 'customer' table,Ģ. In this page we are going to discuss, how rows can be removed from a table by SQL DELETE statement with the use of IN operator and SUBQUERIES.ġ. SQL delete records using subqueries with alias and IN check the existence of the subquery is true or false. 'da' and 'cu' are the aliases for the table 'agent1' and 'customer'Ģ. To remove rows from the table 'agent1' with following conditions -ġ. In this page, we are going to discuss, how table aliases( when two or more tables used in a query, then alias makes it easy to read and write with a short name which comes after the table name after the FROM keyword) can be used with SUBQUERIES (A SELECT statement within another SELECT statement can be used as a subquery ), and with the help of subqueries SQL DELETE command can be used to delete records. SQL delete records using subqueries with alias ![]() 'working_area' of 'agents' table must be 'London', 'agent_code' should be any 'agent_code' from 'agents' table which satisfies the condition bellow :Ģ. To remove rows from the table 'customer1' with following conditions -ġ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |