Ankith Reddy has Published 996 Articles

Select text after last slash in MySQL?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

1K+ Views

You need to use substring_index() function from MySQL to select text.The syntax is as followsSELECT substring_index(yourColumnName, '/', -1) AS anyAliasName FROM yourTableName;To understand the above concept, let us create a table. The query to create a table is as followsmysql> create table selectTextAfterLastSlashDemo - > ( ... Read More

How to update MongoDB collection using $toLower?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

719 Views

There is a $toLower operator in MongoDB to be used as part of aggregate framework. But, we can also use the for loop to iterate over the specific field and update one by one.Let us first create a collection with documents> db.toLowerDemo.insertOne({"StudentId":101, "StudentName":"John"}); {    "acknowledged" : true,    "insertedId" ... Read More

MySQL check for crashed table?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

909 Views

If a table is crashed that means your ENGINE is NULL or empty. The syntax is as follows to check for crashed table.SHOW TABLE STATUS FROM yourDatabaseName;Let us implement the above syntax to check for crashed table Here, our database name is ‘test3’ with some tablesmysql> show table status from ... Read More

How to operate on all databases from the MongoDB shell?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

159 Views

To operate on all databases from MongoDB shell, you can use listDatabases along with adminCommand().Let’s say we are using a sample database “test”. At first, check the current database with the help of db command.Following is the query to get the current database> db;This will produce the following outputTestFollowing is ... Read More

MySQL ORDER BY Date field not in date format?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

797 Views

The following is the syntax to order by date field which is not in date formatselect *from yourTableName order by STR_TO_DATE(yourColumnName, '%d/%m/%Y') DESC;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table orderByDateFormatDemo    -> (    -> Id ... Read More

IntStream toArray() method in Java

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

266 Views

The toArray() method returns an array containing the elements of this stream.Set the elements in the stream with the IntStream class of() method.IntStream stream = IntStream.of(20, 40, 60, 70, 100, 120, 140);Now, display an array with the elements of this stream using the toArray() method.int[] myArr = stream.toArray();The following is ... Read More

W and Z registers in 8085 Microprocessor

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

3K+ Views

To define Temporary Register, we can mention that it is an 8-bit non-programmable resister used to hold data during an arithmetic and logic operation (temporary resister is used to hold intermediate result). The result is stored in the accumulator, and the flags (flip-flops) are set or reset according to the ... Read More

MySQL Select Statement DISTINCT for Multiple Columns?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

618 Views

To understand the MySQL select statement DISTINCT for multiple columns, let us see an example and create a table. The query to create a table is as followsmysql> create table selectDistinctDemo    -> (    -> InstructorId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentId int,    -> TechnicalSubject ... Read More

How to find absolute difference between two numbers in MySQL?

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

4K+ Views

To get the difference between two number in MySQL, let us first create a demo tablemysql> create table findDifferenceDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstNumber float, -> SecondNumber float ... Read More

Temporary (temp) register in 8085 Microprocessor

Ankith Reddy

Ankith Reddy

Updated on 30-Jul-2019 22:30:25

5K+ Views

Temporary register is also an 8-bit register which the programmer can’t access at all. It is temporarily stored inside 8085 microprocessor which is 8 bit operand to the instruction set. For example, when the fetching of instructions “MVI M, 34H” is done the instruction register IR register will receive the ... Read More

Advertisements