Average Total from Score Column in MySQL

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

88 Views

You can use DISTINCT along with COUNT(). Let us first create a table −mysql> create table DemoTable    -> (    -> Id int,    -> Score int    -> ); Query OK, 0 rows affected (0.95 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, 90); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(10, 190); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(11, 230); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(11, 130); Query OK, 1 row affected (0.17 ... Read More

HTML DOM readyState Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

180 Views

The DOM readyState property returns the loading status of the current HTML document.SyntaxFollowing is the syntax −document.readyStateExampleLet us see an example of readyState property − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: #ff7f5094;       height:100%;    }    p{       font-weight:700;       font-size:1.2rem;    }    .btn{       background:#0197F6;       border:none;       height:2rem;       border-radius:2px;       width:35%;       margin:2rem auto;       ... Read More

HTML DOM Input Time Type Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

232 Views

The HTML DOM Input Time type property returns/sets type of Input Time.SyntaxFollowing is the syntax −Returning string valueinputTimeObject.typeSetting type to string valueinputTimeObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailstimeIt defines that input type is timedatetime-localIt defines that input type is datetime-localcheckboxIt defines that input type is checkboxtextIt defines that input type is textExampleLet us see an example of Input Time type property − Live Demo Input Time type    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px; ... Read More

Clear Console Using C++

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

12K+ Views

We can clear the console using C++ code. To do this we have to execute some system commands. In Linux systems, the POSIX is used. We can call system() function to execute system command. For clearing the console in linux, we can use “clear” command. This will be passed inside the system() function.Let us see the code to get the better idea.Example#include using namespace std; int main () {    cout

Execute Task Repeatedly After Fixed Time Intervals in iOS

Anvi Jain
Updated on 30-Jul-2019 22:30:26

298 Views

Apple has predefined class Timer, that fires after a certain time interval has elapsed, sending a specified message to a target object.To read more about the Timer class you can check official apple documentation herehttps://developer.apple.com/documentation/foundation/timerTo execute the task repeatedly after fixed interval of time we are going to use timer class. We are going to develop a sample application where the application prints hello Tutorials Point after every 5 seconds.So let’s get started, Step 1  − Open Xcode → New Project → Single View Application → Let’s name it “HelloTutotrialsPoint”Step 2  − Open ViewController.swift and write one method doSomething() below ... Read More

Add a Tab in JTabbedPane with Java

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

1K+ Views

Let us first create a JTabbedPane −JTabbedPane tabbedPane = new JTabbedPane();Create some panels −JPanel panel1, panel2, panel3, panel4, panel5; panel1 = new JPanel(); panel2 = new JPanel(); panel3 = new JPanel(); panel4 = new JPanel(); panel5 = new JPanel();Now, add tabs using the addTab() method and set the panels as well in which the tabs would be visible −tabbedPane.addTab("PHP", panel1); tabbedPane.addTab("Blockchain ", panel2); tabbedPane.addTab("Matlab", panel3); tabbedPane.addTab("JSP ", panel4); tabbedPane.addTab("Servlet", panel5);The following is an example to add a tab in JTabbedPane −package my; import javax.swing.*; import java.awt.*; public class SwingDemo {    public static void main(String args[]) {       ... Read More

Main Method in Java: Why It Is Always Static

raja
Updated on 30-Jul-2019 22:30:26

17K+ Views

Java main() method is always static, so that compiler can call it without the creation of an object or before the creation of an object of the class.In any Java program, the main() method is the starting point from where compiler starts program execution. So, the compiler needs to call the main() method.If the main() is allowed to be non-static, then while calling the main() method JVM has to instantiate its class.While instantiating it has to call the constructor of that class, There will be ambiguity if the constructor of that class takes an argument.Static method of a class can be ... Read More

Print Results of Script in MongoDB

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

1K+ Views

We will use printjson() for this. Let us first create a collection with documents −> dbprintResultScriptDemoinsertOne({"StudentName":"John", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf22c02b64a577be5a2bc0b") } > dbprintResultScriptDemoinsertOne({"StudentName":"Carol", "StudentAge":20}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf22c09b64a577be5a2bc0c") } > dbprintResultScriptDemoinsertOne({"StudentName":"David", "StudentAge":19}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf22c11b64a577be5a2bc0d") }Following is the query to display all documents from a collection with the help of find() method −> dbprintResultScriptDemofind();This will produce the following document −{ "_id" : ObjectId("5cf22c02b64a577be5a2bc0b"), "StudentName" : "John", "StudentAge" : 21 } { "_id" : ObjectId("5cf22c09b64a577be5a2bc0c"), "StudentName" : "Carol", "StudentAge" : 20 } { "_id" ... Read More

HTML DOM Input Time Value Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

128 Views

The HTML DOM Input Time value property returns a string, which is the value of the value attribute of input Time. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputTimeObject.valueSetting value attribute to a string valueinputTimeObject.value = ‘String’ExampleLet us see an example of Input Time value property − Live Demo Input Time value    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       ... Read More

Create Directory Tree Using C++ in Linux

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

1K+ Views

In this section we will see how to create a directory tree using C++ code in Linux. In Linux terminal we can put some command like “mkdir –p /dir/dir1/dir2” Here –p is used to mark as parent (recursively create inner directories).In C++ code we can use some libraries of Linux system. Then we can use Linux terminal commands as string argument of the system() function. We can create directory tree like this.Example#include #include #include #include using namespace std; int main() {    int status;    status = system("mkdir -p TP/My_Folder/test"); // Creating a directory    if ... Read More

Advertisements