Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL How to use between in mysql.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rakesh dilip patil
How to use between in mysql.
1 Answer(s)      2 years and 7 months ago
Posted in : SQL


I want to display records inbetween two dates and also want to use where condition( like and deptname='Pediatry Department').


Advertisement
View Answers

April 3, 2012 at 1:42 PM


Syntax:

SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2

Here is an example, we have a table named data(id, name, dob,deptName.....) and we have to find the data of a person whose names starts with r and deptname is software and dob lies between two specified dates.

Here is the query for this:

select * from data where dob between '2005-12-01'and '2005-12-31' and name LIKE 'r%' and deptName='software';


Related Tutorials/Questions & Answers:
How to use between in mysql.
How to use between in mysql.  I want to display records inbetween two dates and also want to use where condition( like and deptname='Pediatry... WHERE column_name BETWEEN value1 AND value2 Here is an example, we have a table
HOW CN I USE WHERE AND BETWEEN CLAUSE SIMULTANEOUSLY... IN MYSQL
HOW CN I USE WHERE AND BETWEEN CLAUSE SIMULTANEOUSLY... IN MYSQL  sir, how can i use WHERE and BETWEEN clause simultaneously..? my tables details... between two dates whose expfor_id = 1 my query is SELECT * FROM expenditures
Advertisements
How to select Data Between Two dates in Java, MySQL
How to select Data Between Two dates in Java, MySQL  How to select Data Between Two dates in Java, MySQL? Thanks in advance.   http://www.v7n.com/forums/coding-forum/294668-how-select-data-between-two-dates-php
how to use mysql event scheduler in hibernate
how to use mysql event scheduler in hibernate  Hi all, I am creating... of time, i need to use mysql event scheduler My query is like this create event... use this query in function session.createQuery("); it gives exception
how to use float datatype in mysql? - SQL
how to use float datatype in mysql?  how to use float datatype in mysql?  hi Chitra this code help u CREATE TABLE `paging` ( `Id` float(10,2) NOT NULL default '0.00', `name` varchar(255) default NULL
mysql between dates not between dates
mysql between dates not between dates  I am trying to list the data between dates and not between dates using join method ..but that not working for me
Difference between Mysql and SQL
Difference between Mysql and SQL  hello, What is the difference between Mysql and SQL??   hii, SQL is structural quary language but mysql is database package
Upgrading databases between MySQL 5.0 to MySQL 5.5
Upgrading databases between MySQL 5.0 to MySQL 5.5  Upgrading databases between MySQL 5.0 to MySQL 5.5
mysql difference between two numbers
mysql difference between two numbers  How to get total bate difference between two dates for example 1/01/2012 and 1/02/2012 in MYSQL?   ..., '01/02/2012', 103))   DATEDIFF() in MYSQL always returns the difference
PHP and MySQL BETWEEN dates with different years
PHP and MySQL BETWEEN dates with different years  I have a database... they should only show on the site when the date chosen falls between those dates. I thought it made sense to make use of the SQL BETWEEN statement, but it does
Mysql Date in between
Mysql Date in between       The Tutorial illustrates an example Mysql date in between . In this Tutorial we illustrate an example that help you to get the date in between. Query
What is the difference between mysql_fetch_object and mysql_fetch_array?
What is the difference between mysql_fetch_object and mysql_fetch_array?  What is the difference between mysqlfetchobject and mysqlfetcharray
How To Use Database Driver
.style1 { text-align: center; } How To Use Database Driver Database... and connection between database and driver. It maintains a list of driver...; Class.forName("com.mysql.jdbc.Driver"); //MySql Driver   
how insert multiple images in mysql database with use of struts 1.3.8 or java method, with single bean,or using array
how insert multiple images in mysql database with use of struts 1.3.8 or java method, with single bean,or using array  i am using netbeans 7.0 ,with struts 1.3.8 and i want to insert multiple images in mysql database ,with use
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.  Initially,display 7or10 records on a jsp pageand when click on the NEXT button(or href link) then display next 7 records
Difference between not null and primary key in mysql
Difference between not null and primary key in mysql  Explain not null and primary key in mysql
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript  when click on the next..._name where id=..; database:mysql technology:jsp,servlet,javascript,jstl  
What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?
What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?  What are the differences between mysqlfetcharray(), mysqlfetchobject(), mysqlfetchrow
MySql Remove Tutorials
the command. But other ways is to use the UI interfaces for MySQL. There are some free UI for MySQL also.  You can also use the UI tool such as PHPMyAdmin....    We can use MySQL Delete statement
How to get factorial in mysql
How to get factorial in mysql  Hi, In order to improve the speed of my queries, one in particular tries to find matches between multiple tables, I am trying to use prime numbers to speed the process, but I have been googling
MySQL Arithmetic
MySQL Arithmetic This example illustrates how to use arithmetic operator in the MySQL. In this example we use arithmetic operator (+, /, -, *, %).   Query   Output  
MySQL Attribute
MySQL Attribute This example illustrates how to use the COLLATE attribute in MySQL. In this example we use the COLLATE attribute to define the attribute of the table. In the query below character data types (CHAR, VARCHAR, TEXT) can
How alter table in MySQL?
How alter table in MySQL?  Hi, I have a table and I want to alter an int field into text field. How to alter the table in MySQL? Thanks   Hi, You can use the following query: alter table employees change empid empid
How to use Servlet and Ajax?
How to use Servlet and Ajax?  How to use Servlet and Ajax
MySQL Count
MySQL Count       This example illustrates how to use count() in MySQL database. Count(): The Count.... It returns a numeric value. If you use COUNT(*) that counts the number of rows.  
How to connect mysql with jsp
How to connect mysql with jsp  how to connect jsp with mysql while using apache tomcat
What is the difference between MongoDB and MySql?
The difference between MongoDB and MySql is that the in former one whole... than MySql will work perfectly but if a data is complex and you want to store serialized arrays or JSON objects then MongoDB is advised. MySql has JOIN
how to use calender in php
how to use calender in php  how to put calender in php
Hibernate Built-in criterion "between" Date
will learn about how to use the built-in criterion ' between '... by the Restrictions factory class. Between criterion applied the between constraint on the specified properties i.e it returns the value between the specified minimum
How to use AT Commands with J2ME?
How to use AT Commands with J2ME?  How to use AT Commands with J2ME? Thank you for your answer
how to use mouse pressed
how to use mouse pressed   to action mouse clicked
 

 

 

DMCA.com