Friday, 28 December 2018

MySQL Queries

------------------------------------------------------------------------------------------
1. To find the entries/ids not existing in another table:
------------------------------------------------------------------------------------------

SELECT * FROM tableB WHERE ID NOT IN (SELECT ID from tableA);

------------------------------------------------------------------------------------------
2. To find those entries/ids whose count is greater than 5:
------------------------------------------------------------------------------------------

select ID from tableA GROUP BY ID HAVING count(*)>5;

------------------------------------------------------------------------------------------
3. To connect to a mysql db from another machine:
------------------------------------------------------------------------------------------


Pre-requisites: mysql client must be installed on the instance from where mysql command is to be fired:

mysql -u alfresco -h DB_HOST_NAME -p

Above command will prompt for password. Enter the password, and you are good to go.

No comments:

Post a Comment