substring with mysql

Suppose you have the following table Students

You want to query the Name whose Marks is greater than 75 in asending order by last three characters of Name and in asending order by ID

Here is one way to acheive the goal in mysql:

SELECT Name
  FROM STUDENTS
  WHERE Marks …

difference between number of all records and distict records

In sql, distinct means no duplicates. Thus, the number of all records and the number of duplicates records of one field if any, can be different.

Suppose you have the following table

If the table STATION has duplicate CITY value, you can find out the difference between the number of …

I got a python certification from freeCodeCamp!

I'm proud of myself! 🙌

You can check it out on freeCodeCamp as well.

This certificate is given to a person who finishes Scientific Computing with Python course and complete five projects. You can check out my codes on my git repository named py4e.

Print more than one thing

In python print() can take more than one argument. So the code below is legit.

>>> print(1,2,3,4,'hello')
1 2 3 4 hello

If you have a list li and you want to print li like above, separated by comma …

Telephone Number Validator

Return true if string str is US telephone number, false otherwise.

US telephone numbers look like these:

'555-555-5555', 
'(555)555-5555', 
'(555) 555-5555', 
'555 555 5555', 
'5555555555', 
'1 555 555 5555', 
'1 (555) 555-5555', 
'1(555)555-5555', 
'1 456 789 4444'

But not like these:

"1 555)555-5555", 
"555-5555", 
"5555555", 
"123**&!!asdf#", 
"55555555", 
"(6054756961)", 
"2 (757) …