No, you need to use open and close parenthesis like this ( ) while creating a table. Use the below syntax −CREATE TABLE IF NOT EXISTS yourTableName ( yourColumnName1 dataType1, . . . . . N );Let us first create a table −mysql> CREATE TABLE IF NOT EXISTS DemoTable ( CustomerId int, CustomerName varchar(20), CustomerAge int , PRIMARY KEY(CustomerId) ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1, 'Chris', 25); Query OK, 1 row ... Read More
The start attribute of the element is used to set the start value of the first list item.. Following is the syntax−Above, num is the number set for the start value of the first list item. Let us now see an example to implement the start attribute of the element−Example Live Demo Last Semester MCA Result Rank from 1-5 Steve David Kane William John Rank from 5-10 Tom Jack Will ... Read More
The java.sql.Types class represents the SQL datatype in integer format. The valueOf() method of the enumeration JDBCType accepts an integer value representing the java.sql.Type and, returns the JDBC type corresponding to the specified value.ExampleLet us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE TABLE MyPlayers( ID INT, First_Name VARCHAR(255), Last_Name VARCHAR(255), Date_Of_Birth date, Place_Of_Birth VARCHAR(255), Country VARCHAR(255), PRIMARY KEY (ID) );Following JDBC program establishes connection with the MySQL database retrieves the contents of the MyPlayers table into a ResultSet object, obtains its metadata, obtains the column ... Read More
For this, use the aggregate function SUM(). Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> € int -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(€) values(10); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(€) values(200); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(€) values(190); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select *from ... Read More
The HTML DOM option defaultSelected property returns the default value of option element in an HTML document.SyntaxFollowing is the syntax −object.defualtSelectedExampleLet us see an example of defaultSelected property − Live Demo html{ height:100%; } body{ text-align:center; color:#fff; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height:100%; } p{ font-weight:700; font-size:1.2rem; } .drop-down{ width:35%; border:2px solid #fff; font-weight:bold; padding:8px; ... Read More
In this section we will see how to count how many of elements whose absolute values are distinct? Suppose in an array there are few elements like {5, 5, 6, -5, 8, 2, -2, 1}, so there are 8 elements. But there are 5 elements {5, 6, 8, 2, 1} which are distinct. The -5 and 5 are not considered as different, they are same as their absolute value is same.To solve this problem, we will use the Set data-structure. In set duplicate elements are not allowed. And when we are inserting item into the set, we will push only ... Read More
Here we will see what will be the results, if we exceed the range of built-in datatypes in C++. So let us see some examples.First one is the character type data. Here we are using a loop from 0 to 300, so it should print from 0 to 300, then stop. But it will generate one infinite loop. The character type data holds from -128 to 127. So after increasing from 127, it will be -128 again. So it will never reach at the point 300.Example#include using namespace std; int main() { for (char x = 0; x ... Read More
Stored procedures are sub routines, segment of SQL statements which are stored in SQL catalog. All the applications that can access Relational databases (Java, Python, PHP etc.), can access stored procedures.Stored procedures contain IN and OUT parameters or both. They may return result sets in case you use SELECT statements. Stored procedures can return multiple result sets.To create a stored procedure in (MySQL) a database using JDBC API you need to −Register the Driver: Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection: Connect to the database using the getConnection() method ... Read More
To define aliases in MongoDB shell, you can use below syntax −Object.defineProperty(this, 'yourFunctionName', { get: function() { yourStatement1, . . return N }, enumerable: true, configurable: true });Following is the syntax to assign with var −var anyAliasName=yourFunctionName;Let us implement the above syntax in order to define an aliases in the MongoDB shell. Here, 'displayMessageDemo' is our function −> Object.defineProperty(this, 'displayMessageDemo', { ... get: function() { ... return "Hello MongoDB" ... }, ... enumerable: true, ... configurable: true ... });Query to assign function to var in MongoDB shell −> var myMessage = displayMessageDemo;Let us display the value of above aliases −> myMessage;This will produce the following output −Hello MongoDB
To set the location of the tabs in a JTabbedPane container, use the LEFT constant. Here, we will set the position to the left −JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);The following is an example to set the location of the Tabs in a JTabbedPane Container to the left −Examplepackage my; import javax.swing.*; import java.awt.*; public class SwingDemo { public static void main(String args[]) { JFrame frame = new JFrame("Devices"); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT); JTextArea text = new JTextArea(100, 100); JPanel panel1, panel2, panel3, panel4, panel5, panel6, panel7, ... Read More