Reset
Get Employees Where Name Is Not Null
Program Info
Program Code
×

Get Employees Where Name Is Not Null

This query gets all employees whose name field is not empty (NULL).

Footer

×

Get Employees Where Name Is Not Null

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->whereNotNull('name')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get Employees with a Null Name
Program Info
Program Code
×

Get Employees with a Null Name

This query gets all employees whose name field is NULL.

Footer

×

Get Employees with a Null Name

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->whereNull('name')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get Employees with ID 50000 or Higher
Program Info
Program Code
×

Get Employees with ID 50000 or Higher

Fetches all employees whose id is 50000 or greater and displays the results.

Footer

×

Get Employees with ID 50000 or Higher

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->where('id','>=',50000)->get();
        echo "<pre>";
        print_r($data->toArray());

    }
}

Footer

Get Employees Within Multiple ID Ranges
Program Info
Program Code
×

Get Employees Within Multiple ID Ranges

This query gets employees whose ID is between 13 and 14, or between 10 and 90.

Footer

×

Get Employees Within Multiple ID Ranges

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->whereBetween('id',[13,14])->orwhereBetween('id',[10,90])->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get Maximum Employee ID
Program Info
Program Code
×

Get Maximum Employee ID

This query gets the highest id value from the employee table. It is useful for finding the latest or largest employee ID.

Footer

×

Get Maximum Employee ID

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->max('id');
        echo "<pre>";
        print_r($data);
    }
}

Footer

Get Selected Employee Details
Program Info
Program Code
×

Get Selected Employee Details

This query gets the name, email, and address of all employees from the employee table and displays the result as an array.

Footer

×

Get Selected Employee Details

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->select('name','email','address')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get the First 10 Employees
Program Info
Program Code
×

Get the First 10 Employees

This query fetches the first 10 records from the employee table and displays the result as an array.

Footer

×

Get the First 10 Employees

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->limit(10)->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get the Latest Employee Record
Program Info
Program Code
×

Get the Latest Employee Record

This query creates a query to get the latest employee record based on the created_at column. It does not run the query yet.

Footer

×

Get the Latest Employee Record

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->latest();
        echo "<pre>";
        print_r($data);


    }
}

Footer

Get Unique Employee Records
Program Info
Program Code
×

Get Unique Employee Records

This query gets unique records from the employee table and displays the data.

Footer

×

Get Unique Employee Records

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->distinct()->get();
        echo "<pre>";
        print_r($data->toArray());

    }
}

Footer

Insert a New Contact Record with a Random Employee ID
Program Info
Program Code
×

Insert a New Contact Record with a Random Employee ID

This query adds a new record to the contact table. It generates a random ID between 11111 and 99999 and stores the mobile number 1234567890.

Footer

×

Insert a New Contact Record with a Random Employee ID

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        DB::table('contact')->insert(['id'=> mt_rand(11111,99999),'mobile'=>1234567890]);

    }
}

Footer

Showing page  6  of  8  (Total  77 records)
« Prev  1 ... 4  5  6  7  8  Next »
×
Name : Krishna Verma    |    Father's Name : Mr. Satish Kumar    |    Email ID : krishnaverma28081997@gmail.com    |    Religion : Hindu    |    Address : Dayampur, kanker khera, Meerut Cantt (250001), UP    |    Date of Birth : 28 August 1997    |    Marital Status : Non-Married    |    Place of Birth : Dayampur Kanker Khera Meerut Cantt.    |    Gender : Male    |    Age : 28    |    Contact : 9520335394    |    Father's Occupation : Sports man    |    Mother's Name : Smt. Kuntesh Devi    |    Mother's Occupation : Homemaker    |    Number of Brothers : 1    |    Number of Sisters : 1    |    Current Residence : Dayampur kanker khera meerut cantt    |    Family Type : Nuclear Family    |    Family Name : verma    |    Height : 5' 6"    |    Weight : 70 kg    |    Complexion : Fair    |    Body Type : Athletic    |    Hair Color : Black    |    Health Status : Good    |    Any Physical Disability : No    |    Highest Qualification : B.Tech (CSE)    |    Master Skill : PHP Laravel    |    Total Projects : 40 +    |    Total Skills : 25 +    |    Languages Known : Hindi and English    |    Website : krishnaportfolio.in    |    Siblings : 3    |    Nationality : Indian    |    Total Experience : 5 Years    |    LinkedIn : https://www.linkedin.com/in/krishna-verma-840b71356/    |    Total Programs : 10000    |    Total Projects : 40    |    Total Skills : 25    |    Total Experience : 5    |    Total DSA Problems : 200    |    Total Served Companies : 2    |    Leetcode : https://leetcode.com/u/krishnavermadeveloper/    |    Naukri : https://www.naukri.com/mnjuser/profile?id=&altresid