Adding Ordered Unordered Lists To define a list item in HTML, use the tag. It can be used inside ordered lists (), unordered lists () and menu lists (). In an ordered list , the list items are displayed with numbers or letters. In an unordered list , and a menu list , the list items are displayed with bullet points. Syntax Following is the syntax list item in HTML − ……… The list tag also supports the following additional attributes − ... Read More
Recursive Factorial Calculation A strong number is a number, where the sum of the factorial of its digits equals the number itself. In C programming, a factorial is the product of all positive integers less than or equal to a given number. To calculate the factorial of a number, we use a recursive function with the argument N. This function will repeatedly call itself with a decremented value of N, multiplying the results until it reaches 1. 123!= 1!+2!+3! =1+2+6 =9 In this case, 123 is not a strong number because the sum of the factorial of its digits ... Read More
In this article, we will learn to sort ArrayList of custom objects by property in Java. The ArrayList class extends AbstractList and implements the List interface. ArrayList supports dynamic arrays that can grow as needed. Problem Statement ArrayList is created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk. Below is a demonstration of the same − Input − The list is defined as Java Scala Python Mysql Output − The list after sorting values: Java Mysql Python Scala ... Read More
In this article, we will learn to convert milliseconds to readable strings in Java. Converting milliseconds into a human-readable format such as hours, minutes, seconds, and milliseconds is a common programming task, especially in time-sensitive applications. Problem Statement The challenge is to convert a given time in milliseconds into a readable string that shows hours, minutes, seconds, and remaining milliseconds. Input long millis = 5000000; Output Hours = 1 Minutes = 23 Seconds = 20Milliseconds = 0 1 hr(s) 23 min(s) 20 sec(s) 0 ms Approaches to convert millisecond to readable string Following are the two different approaches to converting milliseconds ... Read More
In MySQL, the ENUM is a data type that is used to create a column with a fixed set of values. It is helpful for the fields that have limited alternatives, such as categories, statuses, and color codes. In the ENUM data type, if you do not declare NOT NULL then it gives the default value NULL or Empty String('') when inserting records without specifying a value. However, if you declare NOT NULL and don't specify the values when inserting then it gives the first value from the ENUM. Following is the syntax to create a table that has ... Read More
Yes, you can include a string value with spaces in ENUM type. This is particularly useful when we add descriptive options that contain multiple words. Let us explore how to create, describe, and use ENUM columns containing spaces, with supporting examples. ENUM vs VARCHAR: While both ENUM and VARCHAR can store strings with spaces, ENUM has an advantage: limiting of the number of entries that can be added into a column to a fixed set. Because of this, it is useful in situations where the values are limited and static, such as size categories, and status codes. Whereas VARCHAR is ... Read More
No, SQL Server doesn’t offer a direct equivalent to MySQL’s ENUM data type, but you can replicate similar functionality with a combination of VARCHAR, and a CHECK constraint. This allows you to restrict the possible values for a column, just like ENUM does in MySQL. This article will look at how SQL Server can handle ENUM-like behavior and examples of how it is being utilized in your database design. Enum in MySQL In MySQL, the ENUM is a data type that is used to create a column with a fixed set of predefined values which allows data integrity. ... Read More
Removing Value from an enum in MySQL We can use the ALTER command to remove a value from an ENUM in MySQL. The ALTER database command lets you modify the type of a column, add or remove columns, or even modify ENUM values in a current database. You cannot delete a value from an ENUM type. To accomplish that task, you change the column definition - by changing the list of allowed values. This way, the structure of the table is not changed while the set of possible values for the ENUM column is changed. Example Let us first create ... Read More
When designing a database, setting default values for certain fields will improve data integrity. In MySQL, ENUM data type allows you to specify predefined values for a column such as status (complete or incomplete). This article helps you to set a default value for ENUM columns, to ensure that even if the data is missing, a suitable value is automatically assigned. Inserting a default value with ENUM data type We can do this with the help of the DEFAULT attribute of the ENUM data type. The DEFAULT attribute causes an ENUM data type to have a default value when a ... Read More
Stored Procedures Stored Procedures is a group of pre-compiled SQL statements that is stored in a database and can be reused anytime. It allows you to do many things in one command. So doing several activities in a database will be easier and quicker than before. A stored procedure can be called from SQL commands as well as applications like Python, Java, or PHP. Syntax Following is the syntax to create a stored procedure − CREATE PROCEDURE procedure_name AS BEGIN -- SQL statements END; Example Let us create a stored procedure where it ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP