ORDER BY alphabet first then follow by number in MySQL?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

727 Views

You need to use regular expression with ORDER BY clause. The syntax is as follows:SELECT *FROM yourTableName ORDER BY IF(yourColumnName RLIKE '^[a-z]', 1, 2), yourColumnName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table AlphabetFirstThenNumberDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(20),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.95 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into AlphabetFirstThenNumberDemo(Name) values('John'); Query OK, 1 row affected (0.37 sec) mysql> insert ... Read More

Sample questions for ITIL Foundation Course

yashwanth sitamraju
Updated on 30-Jul-2019 22:30:24

156 Views

Information Technology Infrastructure Library (ITIL) is the framework that is designed to standardize the planning, selection, and delivery of IT services to a business. The goal of ITIL is to improve efficiency and also achieve predictable goals or targets. An ITIL enables an IT professional to be a business service partner, not just back-end support.ITIL Foundation ExaminationIt is a closed book examination.It consists of 40 questions.Each question has multiple choices.One mark is allotted for the correct answer.The duration of the exam is one hour.One has to score 65% of the marks to pass the examination i.e minimum 26 questions must ... Read More

How to create JSON format with group-concat in MySQL?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

1K+ Views

You can create JSON format using group_concat() function from MySQL. The syntax is as follows −SELECT yourColumnName1, GROUP_CONCAT(CONCAT('{anytName:"', yourColumnName, '", anyName:"', yourColunName, '"}')) anyVariableName from yourTableName group by yourColumnName1;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table JsonFormatDemo -> ( -> UserId int, -> UserName varchar(100), -> UserEmail varchar(100) -> ); Query OK, 0 rows affected (0.99 sec)Insert some records in the table using insert ... Read More

What is a robonaut? Can it replace astronauts in the future?

Shanmukh Pasumarthy
Updated on 30-Jul-2019 22:30:24

127 Views

Robonaut is a NASA robot, which is designed as a humanoid. The artificial intelligence makes it easier for Robonaut to do the same jobs as a human. Robonaut could help with anything from working on the International Space Station to exploring other worlds. The core idea behind the Robonaut series is to have a humanoid machine work alongside astronauts. Its form factor and dexterity are designed such that Robonaut can use space tools and work in similar environments suited to astronauts.These new space explorers won’t need space suits or oxygen to survive outside of the spacecraft. Thus they might help ... Read More

Non-Programmable 8-Bit I/O Port

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

375 Views

There are two types of Input Output ports. They are Programmable Input Output ports and Non-Programmable Input Output ports. Since the functions of Programmable Input Output ports changed by software they became more popular. We don't need to change the wiring rather the hardware of the I/O port to change the function. Intel 8255 is a popular Input Output chip based on port. Whereas the I/O ports which are non-programmable needs to change the wiring or the hardware to change its complete function. We will see in later that the connection needs to be changed when 8212 works like an ... Read More

Print Colors of terminal in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

588 Views

In the terminal, if you want to make some texts appears in colored mode, there are numerous ways in python programming to achieve it.Using python modules1.termcolor module: It is the ANSII Color formatting for output in the terminal.import sys from termcolor import colored, cprint text1 = colored('Hello, Tutorialspoint!', 'blue', attrs=['reverse', 'blink']) print(text1) cprint('Hello, Python!', 'blue', 'on_white') print_red_on_blue = lambda x: cprint(x, 'red', 'on_blue') print_red_on_blue('Hello, from Data Science!') print_red_on_blue('Hello, Python!') for i in range(10):    cprint(i, 'green', end=' ') cprint("Attention!", 'blue', attrs=['bold'], file=sys.stderr)ResultRead More

How to delete last record (on condition) from a table in MySQL?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

7K+ Views

To delete last record (on condition) from a table, you need to use ORDER BY DESC with LIMIT 1. The syntax is as follows:DELETE FROM yourTableName WHERE yourColumnName1=yourValue ORDER BY yourColumnName2 DESC LIMIT 1;The above syntax will delete last record (on condition) from a table. It sorts the column in descending order and choose the first element to delete.To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table UserLoginTable    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> UserId int,    -> UserLoginDateTime datetime,    -> PRIMARY ... Read More

Add grouping specifiers for large numbers in Java

Samual Sam
Updated on 30-Jul-2019 22:30:24

151 Views

For using the Formatter class, import the following package −import java.util.Formatter;We can group specifiers as shown below −Formatter f = new Formatter(); f.format("%,.2f", 38178.9889);The above sets thousands separator and 2 decimal places.The following is an example −Example Live Demoimport java.util.Formatter; public class Demo { public static void main(String args[]) { Formatter f = new Formatter(); f.format("%d", 50); System.out.println(f); f = new Formatter(); f.format("%,.2f", 38178.9889); System.out.println(f); } }Output50 38,178.99

How to get a list of MySQL user hosts?

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

339 Views

Firstly, get a list of MySQL user accounts, using MySQL.user table. You can use select user column from MySQL.user table to get a list of MySQL user accounts.The query is as follows −mysql> select user from MySQL.user;The following output displays all the users −+------------------+ | user             | +------------------+ | Manish           | | mysql.infoschema | | mysql.session    | | mysql.sys        | | root             | | am               | +------------------+ 6 rows in set (0.06 ... Read More

Which is the coldest planet in the solar system?

Shanmukh Pasumarthy
Updated on 30-Jul-2019 22:30:24

194 Views

Neptune is the coldest planet in the solar system as Pluto has been excluded as it was regarded as a dwarf planet. It is the eighth and farthest known planet from the Sun. It has 17 times the mass of Earth and is the fourth largest planet in the solar system. It takes 164.8 years for Neptune to finish one revolution around the sun and the elliptical orbit of Neptune is inclined 1.77° compared to that of Earth.Voyager 2 is the only spacecraft that visited Neptune. It analyzed Neptune's rotation, tilt, weather conditions and also its moons and ring systems.Physical ... Read More

Advertisements