Set Responsive Font Size using CSS

radhakrishna
Updated on 30-Jun-2020 07:48:43

328 Views

To set the responsive font size, use the ‘viewport width’ and set it to ‘vw’ unit. You can try to run the following code to use ‘vw’ unit −ExampleLive Demo                    h1 {             font-size:8vw;          }                     This is demo heading       This is demo text.    

Filter Query on Array of Embedded Document with MongoDB

AmitDiwan
Updated on 30-Jun-2020 07:47:50

342 Views

For this, use aggregate() in MongoDB. Let us create a collection with documents −> db.demo736.insertOne( ...    { ...       "_id": "101", ...       "details1": [ ...          { ...             "details2": [ ...                { ...                   "details3": { ...                      "Name": "John" ...                   } ...                } ... ... Read More

Role of CSS :hover Selector

varma
Updated on 30-Jun-2020 07:46:59

325 Views

Use the CSS :hover selector to style links on mouse over with CSS. You can try to run the following code to implement the :hover selector −ExampleLive Demo                    a:hover {             background-color: orange;          }                     Qries       Keep the mouse cursor on the above link and see the effect.    

Change Root Username in MySQL

George John
Updated on 30-Jun-2020 07:45:45

3K+ Views

To change the root username in MySQL, you need to use UPDATE and SET command. The syntax is as follows −UPDATE user set user = ’yourNewUserName’ WHERE user = ’root’;To understand the above syntax, let us switch the database to MySQL using USE command.The query is as follows to switch the database.mysql> use mysql; Database changedNow list all the users from MySQL.user table. The query is as follows −mysql> select user from MySQL.user;The following is the output −+------------------+ | user             | +------------------+ | Manish           | | User2     ... Read More

Style the Focused Element in CSS

Ankith Reddy
Updated on 30-Jun-2020 07:45:24

127 Views

To select the element that has focus, use the: focus selector. You can try to run the following code to implement the: focus selector −Example                    input:focus {             background-color: green;          }                              Subject          Student:          Age:

Using MongoDB updateOne and insertOne

AmitDiwan
Updated on 30-Jun-2020 07:44:44

1K+ Views

MongoDB insertOne() inserts a document into a collection, whereas updateOne() update a single document in a collection based on a query filter.Let us create a collection with documents −> db.demo735.insertOne({id:1, Name:"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead51b657bb72a10bcf0652") } > db.demo735.insertOne({id:1, Name:"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead51bb57bb72a10bcf0653") } > db.demo735.insertOne({id:1, Name:"Bob"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead51be57bb72a10bcf0654") } > db.demo735.insertOne({id:1, Name:"Carol"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead51c757bb72a10bcf0655") }Display all documents from a collection with the help of find() method −> db.demo735.find();This will produce the following output −{ "_id" ... Read More

Role of CSS :focus Selector

Chandu yadav
Updated on 30-Jun-2020 07:44:17

170 Views

Use the :focus selector to select the element that has focus. You can try to run the following code to implement the :focus selectorExample                    input:focus {             background-color: green;          }                              Subject          Student:          Age:                    

Find City Names Not Starting with Vowels in MySQL

Arjun Thakur
Updated on 30-Jun-2020 07:43:05

13K+ Views

You can use DISTINCT with RLIKE operator to find a list of city names that do not start with vowels.The syntax is as follows −SELECT DISTINCT yourCityColumnName FROM yourTableName WHERE yourCityColumnName NOT RLIKE ‘ ^[AEIOUaeiou].*$’;To understand the above syntax, let us create a table. Here, we have a column for city names.The query to create a table is as follows −mysql> create table Employee_Information    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> EmployeeName varchar(20),    -> CityName varchar(20),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the ... Read More

Difference Between Now and a Given Date with MongoDB

AmitDiwan
Updated on 30-Jun-2020 07:42:37

1K+ Views

To get the difference between dates in MongpDB, use aggregate(). Let us create a collection with documents −> db.demo734.insertOne({GivenDate:new ISODate("2020-01-10")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead4f1a57bb72a10bcf064e") } > db.demo734.insertOne({GivenDate:new ISODate("2020-02-20")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead4f2157bb72a10bcf064f") } > db.demo734.insertOne({GivenDate:new ISODate("2010-12-01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead4f2b57bb72a10bcf0650") } > db.demo734.insertOne({GivenDate:new ISODate("2020-05-01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ead506f57bb72a10bcf0651") }Display all documents from a collection with the help of find() method −> db.demo734.find();This will produce the following output −{ "_id" : ObjectId("5ead4f1a57bb72a10bcf064e"), "GivenDate" : ISODate("2020-01-10T00:00:00Z") } { "_id" : ObjectId("5ead4f2157bb72a10bcf064f"), "GivenDate" ... Read More

Remove All Characters After Last Comma in MySQL String

Ankith Reddy
Updated on 30-Jun-2020 07:40:45

4K+ Views

To remove all characters after the last comma in the string, you can use SUBSTRING_INDEX().If you do not know the location of the last comma, then you need to find the last comma dynamically using LENGTH().The syntax is as follows −UPDATE yourTableName set yourColumnName = SUBSTRING_INDEX(yourColumnName, ', ', LENGTH(yourColumnName) - LENGTH(REPLACE(yourColumnName, ', ', '')));To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table RemoveAllCharacters    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> FullInfo varchar(200),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 ... Read More

Advertisements